Visual C++ :: Getting Exceptions On Windows 7 And 8 On Different Parts Of Code?

Feb 25, 2015

I'm Getting exceptions on Windows 7 and Windows 8 on different parts of the Code? Why this can be happening, why the difference in behavior?

View 6 Replies


ADVERTISEMENT

Visual C++ :: CryptUnprotectData Failing When Code Compiled On Windows 7?

Sep 24, 2012

I have a C++ code that reads the database password from the registry and decrypts it using CryptUnprotectData. We have to deploy this application on a Windows 7 machine.

When I compile my code on Windows XP and run it on the test Windows 7 machine, it works absolutely fine. When I compile the same code on my laptop having Windows 7 and run it on the test Windows 7 machine, CryptUnprotectData fails with GetLastError() return '87'. If I run this application on my own laptop with Windows 7 on it, it again works fine probably because my laptop has a lot of things installed including Visual Studio and all the service packs etc.

I believe I have missed out installing some dependency on the test Windows 7 machine but I am unable to figure out what is that. What is it that's making the Windows XP compiled code running fine on the test machine and not the code that's compiled on Windows 7.

Here is the call to CryptUnprotectData in the code:

if (CryptUnprotectData(
&cipherText,
NULL,
NULL, // Optional entropy
NULL, // Reserved
NULL, // Optional PromptStruct
CRYPTPROTECT_UI_FORBIDDEN,
&plainText))

[code]....

View 10 Replies View Related

C Sharp :: How To Code Array In Windows Form Using Listview In Visual Studio 2008

Oct 5, 2013

This is my problem in my subject programming but i dont how to use Array in windows form ... If i run my code i want my Data in listview would not be disappear if i close the form ...?

View 1 Replies View Related

C :: Possible To Split Command Console Into 2 Parts - Visual And Text Area

Feb 1, 2015

I have had experience in programming from python (slightly related, html/css) and the computercraft from minecraff (basic i think it is).

My question is mainly about the C and past experience with the computercraft.

1. Is it possible to split the command console into 2 parts (a visual area and a text area)
2. Is it possible to use any form of pixel art or custom characters within any command console using C.

View 2 Replies View Related

C++ :: Converting UNIX Code To Windows

Aug 15, 2013

trying to convert some C++ code written for LINUX/MAC to run on windows. I think signal handling is not as developed for Windows but the error I am getting is that the struct I am trying to use is undefined. I have #include <csignal> at the top and the line giving the problem simply says "struct signal act;". Any pointers or is signal a LINUX native command?

View 2 Replies View Related

C/C++ :: How To Use Windows Command-line Commands In Code

Sep 18, 2012

In Windows, if you open a command prompt, there are a bunch of keywords like, 'chdir', 'copy', ...

What I'm trying to figure out is how to use that COPY command in c++ code. I want to use the COPY command with the options (/a, /b, ...).

View 3 Replies View Related

C# :: Windows Phone 8.1 Auto Lock Screen Code

Mar 6, 2015

Auto lock screen coding for windows phone 8.1.

View 2 Replies View Related

C++ :: How To Install Glew For Code Blocks On Windows Vista

Apr 29, 2013

I downloaded glew 1.9.0 files and dragged the lib, include, and bin of the glew into the mingw folder within Code Blocks. I don't know if this is the right thing to do I don't understand how this stuff works. Anyway, I tried to compile my openGL 3.0 program that uses glew and I got this error: The procedure entry point _glewBindArray could not be located in the dynamic link library glew32.dll, How do I install glew properly?

View 1 Replies View Related

C++ :: Developing Application Without Exceptions

Feb 27, 2015

Is it possible to develop any application without exceptions? I don't want to try and catch exceptions and remove it.but I want to write codes which should never create exceptions is it possible?

View 3 Replies View Related

C++ :: Exceptions Thrown During Initialization?

Jul 8, 2014

How exactly would one go about throwing an exception from an object's constructor?

Take a look at this snippet:

#include <iostream>
#include <exception>
class ExceptionFoo : public std::exception {
virtual const char* what() const throw() {

[Code].....

View 8 Replies View Related

C++ :: Custom Exceptions With Default Behaviour

May 24, 2013

I've been pondering which of these 2 approaches would make for the best interface for a library: Defining custom exceptions with specific names for different error scenarios but with standard behaviour, or simply using the predefined exceptions from the STL.

This is my current approach:
Code:
namespace rpp
{
class ConnectionError : public std::exception
{
public:
ConnectionError(const std::string &p_err);

[Code] .....

This seems to make for more descriptive code but it adds no functionality and the implementations are completely identical, which seems "off" to me, somehow.

View 8 Replies View Related

C++ :: Assignment Operator But With Some Member Exceptions

Jan 9, 2015

The task is to use the assignment operator of a class, but change all the data except certain ones. For example, below we are to assign all Person data of 'other' except for 'name' and 'ID':

#include <iostream>
#include <string>
struct Person {
std::string name;
int ID, age, height, weight;

[Code] .....

Name = Bob
ID = 2047
Age = 38
Height = 183
Weight = 170

Name = Frank
ID = 5025
Age = 25
Height = 190
Weight = 205

Bob pretends to be Frank, but keeps his name and ID.

Name = Bob
ID = 2047
Age = 25
Height = 190
Weight = 205

But I think the way I did it is pretty lousy (note the wasted steps changing the name and ID only to revert them back? So the ideal solution should require no wasted steps, unlike the method above, and changes to what the exclusions should be should be in only one place (not two like above). Of course, we assume that Person shall have many, many data members (and constantly increasing), so that simply defining Person::operator= (const Person& other) to handle all data except for 'name' and 'ID' is out of the question.

View 3 Replies View Related

C++ :: Catching Exceptions From Initializer List

Jan 4, 2015

In order to test catching exceptions from an initializer list, I deliberately did bad practice by hard coding an argument to a ctor that would cause a std::bad_allocto be thrown. Obviously better practice is to send a variable, but that would cause a compile error, so I hard coded a value.

The program I wrote creates Prime Numbers up to a specified limit which is an argument to the ctor of type std::size_t. The program works fine IMO, using g++ in cygwin:

$ time ./PrimesExe
Limit is 2000000
148933 Primes Created

real 0m1.210s
user 0m1.123s
sys 0m0.046s

Now when I send something invalid like a negative number or something too big for std::size_t, the program seems to run indefinitely, when compiled with g++ under cygwin. I haven't tested it yet on Linux.

However, if I do the same on VS2013 express, it takes about 15 seconds to print the expected caught exception message. I was not expecting it to take so ridiculously long compared to the reasonable amount of work involved in doing primes up to 2 million.

I have read up about what is involved in catching exceptions: stack unwinding, keeping track of what needs to be destroyed etc. But this is 1 object with 1 ctor argument, no Base classes or any other complications. So why such a long or indefinite amount of time?

This whole example is probably contrived, and I am wondering whether exceptions is the right tool for this - it is similar to the divide by zero problem, or could be considered a programming error to call a ctor with a bad argument?

Also, catching an exception thrown by an initalizer list seems a bit awkward in that one seems to have enclose the creation of the object and all subsequent uses of it (and any code in between ) in the same try block, otherwise it goes out scope. I suppose I could try to write a wrapper function that returns a smart pointer reference to a valid object, but I would have to test the validity of it's return too. That's the awkward part - there is probably a better way?

Are there any recommended ways of recovering from initializer list exception, that is, to allow the user to enter a new hopefully valid value and try to create the object again?

View 2 Replies View Related

C/C++ :: Finding Optimized Parts By Length?

Feb 4, 2015

I am trying to put together a parts ordering calculator for work, and I am trying to figure out what the best to get what parts to order based on the length of the unit and the length of the parts.

So for example I have a counter that is 600 inches long, and I have 3 type of railings that we would use. The first one is 17 inches, the next one is 14 inches and the last one is 11 inches.

The idea is figuring out how many ( Combination of the 3 ) of the 17, 14 or 11 inch railings does would it take to meet the 600 inches. If it ends up going over, then we can cut it size, but I want to get as close as possible.

So in this situation if the counter is 634 inches, then we would order:

35x 17"
2x 14"
1x 11"

So I would have to write an algorithm i guess to get the best combination of the 3 length of railing to fit the counter with as little excess as possible.

View 3 Replies View Related

C++ :: How To Handle The Exceptions Not Caught By Try / Catch

Nov 2, 2014

Here is an example,

Code:

int main()
{
try{
int y = 0;
int x = 2/y;
}
catch(...)
{
cout<<"catch it"<<endl;
}
return 0;
}

If you try, you will find out that catch(...) couldn't catch exception divided by zero. How'd we catch such exceptions?

View 4 Replies View Related

C++ :: Basic Parts Of Text Based RPGs?

Oct 22, 2013

How you'd type yes or no scenarios for a text based RPG? And I mean a really basic like 'you see ..... what do you do?'. Also, how would you finish a code like this.

View 9 Replies View Related

C :: Program To Show Large Text File In Parts

Jan 1, 2014

I am currently working out on a problem in which a c program is to be made which shows a large text file in parts.
f
For example: If file contains 200 lines. 50 lines will be shown on first page and user is asked to press any key to move to next page until EOF is found. user is allowed to return to previous page as well, and this is very complicated task for me. I tried to move cursor to a specific position using fseek etc but it page doesn't stop and reaches to end quickly.

View 1 Replies View Related

Visual C++ :: Updating To New Windows SDK?

Apr 27, 2013

I've just integrated the Windows SDK V7.0A into my VS2005 application, and I'm getting the dreaded "Application configuration error" when I try to run it on an XP machine.

It runs fine on the development machine, and some customer machines (Win7 and Win8), but will not run on XP due to missing/incorrect version dlls.

I've rebuilt all my libraries, but still no joy.

So, my first question is - If I upgrade the Windows SDK to V7.0A, do I also need to use MFC 10 and msvcrt10, or can I stick with MFC 8?

The next question is, how do I find out which dlls are missing, and which libraries or other dlls are requesting the missing versions?

View 11 Replies View Related

Visual C++ :: Deactivated All Windows Unless ONE

Apr 17, 2013

In my application I have some type of windows showed in an instance of time, and an action shows a new one that i want have the focus all the time , in the way that i can't works with no one of the others. They all are windows, child windows an modeless dialogs, but i don't know how to do. I try use EnableWindow(FALSE) that all the others windows and dialogs, but not works.

View 2 Replies View Related

Visual C++ :: Retrieve IP Information On Any Windows

Sep 23, 2012

I used to retrieve IP and NIC information by querying windows registry. Now I'm trying to use GetAdapterAddresses() API. Using GetAdapterAddresses() to get IP is not that easy, I need to dig a long deep as I check some examples so far, anyways my question is: Calling this API will return success on all versions of Windows ie: 32bits & 64bits ?

Though Microsoft has not opened any source, where this API is actually retrieving Windows IP information.?. Is it reading Registry or some windows file.

View 6 Replies View Related

Visual C++ :: Windows 64 Bit Or 32 Bit Preprocessor Directives?

Jul 1, 2013

I want to connect to an SQL Server database using ADO with VC++.

In order to do that you need to import an external dll, like so:

#import "C:Program Files (x86)Common FilesSystemadomsado15.dll"

What if the OS is not 64 bit? That would mean the (x86)-suffix would be incorrect.

how to work around this using certain preprocessor directives?

Something like this, maybe?:

#if 64bit
#import "C:Program Files (x86)Common FilesSystemadomsado15.dll"
#else
#import "C:Program FilesCommon FilesSystemadomsado15.dll"
#endif

View 9 Replies View Related

Visual C++ :: How To Tell If Windows Partition Is Active

Nov 24, 2014

My goal is to know if Windows is installed on an active disk partition.

View 8 Replies View Related

Visual C++ :: Windows Slideshow Screensaver

Apr 21, 2013

I am looking windows slideshow screen saver source code.

View 5 Replies View Related

Visual C++ :: MFC Child Windows Application

Nov 9, 2013

I am new in Visual C++ and I have to make an MFC application with "child" windows. Here is what i need to achieve - [URL] ..... As you can observe when you click on the cross of popup window or child window 2 both are closing.

View 2 Replies View Related

Visual C++ :: Rapidly Pasting From Clipboard Under Windows 7

Feb 3, 2013

I designed an app for work that lets you enter data in a much more efficient way, then it needs to paste this data into the very curmudgeonly interface we use for work. I designed this app a long time ago while at a different company, and I used VC++ 6. I'm still using VC++ 6, but in a vbox with windows XP.

The code is being called as part of a bigger function that determines what exactly needs to be pasted into the work app spreadsheet. I have to call each item separately because the work app does not take copied tabs the way Excel would or whatever, it just ignores them. And it also pops up boxes and such that need to be handled in other ways.

The result works just fine under Windows XP, but when I do it under my regular Win7 box or on the Win7 boxes at work, it does not work properly.

This sets the data up, Text being the data to be pasted:

Code:
while (1) {
if (OpenClipboard() == FALSE) {
::Sleep(1);
continue;
}
HGLOBAL clipbuffer;
char * buffer;
EmptyClipboard();

[Code] ....

No infinite loops yet, again was just testing if it was OpenClipboard failing because it was being called again too quickly or something (and it did happen occasionally).

Then testing that the clipboard data is correct (this is always true), and pasting with keybd_event. SendInput is not available with VC++ 6.

Code:
HGLOBAL hglb;
LPTSTR lptstr;
LPTSTR buf = Text.GetBuffer(0);
while (OpenClipboard() == FALSE)
::Sleep(1);

[Code] .....

If the ::Sleeps are commented out, it will paste the wrong data almost every time under win7. It seems like it pretty much uses the last thing to be copied in the function and pastes it over and over (but not *always*). If I uncomment them, it will work as expected, but it obviously takes longer. With ::Sleep(50), it works about 80-90% of the time. Obviously I can't have the wrong data being pasted, and I'd prefer not to have to wait like this--and perhaps on a slower system or a system that is doing other things it may take longer and paste the wrong thing. It works fine on XP even without the sleeps.

Did keybd_event become a separate thread or something? Am I doing something wrong with the buffers? (I've tried using CSharedFile too with GMEM_MOVEABLE | GMEM_SHARE | GMEM_ZEROINIT settings, exact same thing.) Why does it work fine under XP but not under 7?

View 10 Replies View Related

Visual C++ :: Error In Registering Windows Class

Jan 28, 2013

The following code it taken from msdn library but it is failing to compile.

the following code has a header where all the variables used here are stored in header App.h.

The following lines are giving trouble:

Code:
DialogBox(pApp->getInstance(), MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, pApp->About);
error: 'App::About': function call missing argument list; use '&App::About' to create a pointer to member

Code:
wcex.lpfnWndProc= &App::WndProc;
error: '=' : cannot convert from 'LRESULT (__stdcall App::* )(HWND,UINT,WPARAM,LPARAM)' to 'WNDPROC'

There is no context in which this conversion is possible

Here is the complete code:

#include "stdafx.h"
#include "App.h"
App::App(void) {
}
App::~App(void) {

[Code] .....

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved