|
what about PreTranslateMessage ??
how could i know the key pressed by the user ??
"The Ultimate Limit Is Only Your Imagination."
|
|
|
|
|
You don't need to use PreTranslateMessage - that's for doing something global to a message before it's processed by a window.
Cheers,
Ash
|
|
|
|
|
I used to get the version and copyright from the resource files using the following
char ThisProgramsName[256]="";
GetModuleFileName(AfxGetInstanceHandle(),ThisProgramsName,256);
DWORD dwHandle = 0;
DWORD dwSize = GetFileVersionInfoSize( ThisProgramsName,&dwHandle );
if(dwSize!=0L) {
UINT uVerInfoSize;
char *lpVerInfo = new char[dwSize];
GetFileVersionInfo(ThisProgramsName, dwHandle, dwSize,lpVerInfo );
The libraries have all changed in VS2010. What do I need to link to satisfy these calls, or has the method of retrieving this information changed.
Same question for GetAdapters
This is the old code
PIP_ADAPTER_INFO pAdapterInfo;
PIP_ADAPTER_INFO pAdapter = NULL;
DWORD dwRetVal = 0;
UINT i;
unsigned long LowestHexIP, PossibleIP;
char MacByte[4], MacID[16], LowestMacID[16];
ULONG ulOutBufLen = sizeof(IP_ADAPTER_INFO);
pAdapterInfo = (IP_ADAPTER_INFO *) MALLOC (sizeof(IP_ADAPTER_INFO));
// Make an initial call to GetAdaptersInfo to get
// the necessary size into the ulOutBufLen variable
if (GetAdaptersInfo (pAdapterInfo, &ulOutBufLen) == ERROR_BUFFER_OVERFLOW) {
FREE (pAdapterInfo);
pAdapterInfo = (IP_ADAPTER_INFO *) MALLOC (ulOutBufLen);
}
ES
|
|
|
|
|
Ed SHaw wrote: The libraries have all changed in VS2010.
I'm not sure this is strictly accurate, according to the GetFileVersionInfo[^] page on MSDN you need Version.lib, and I know from my own projects that this has not changed for some time. I expect GetAdapters will have a similar information page that you can look at.
It's time for a new signature.
|
|
|
|
|
Do you know where I can download the latest version.lib and IPHlpApi.lib for both win32 and x64?
|
|
|
|
|
All these libraries are part of the standard SDK, which (in my case) came automatically with Visual Studio 2010. If you did not get them in this way I guess you need to go to MSDN and search for "Platform SDK".
It's time for a new signature.
|
|
|
|
|
Ed SHaw wrote: What do I need to link to satisfy these calls...
What linker error(s) are you receiving?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Undefined's for GetFileVersionInfoSize(), GetFileVersionInfo(), VerQueryValue()and GetAdaptersInfo().
I think I need version.lib and IPHlpApi.lib for x64 build. I put in the old version for win32 and they build and run ok. I expected new versions of everything with new VS2010
Ed
|
|
|
|
|
Hi
how to catch access violation exception
|
|
|
|
|
Same replies as earlier...
|
|
|
|
|
You can use the function: SetUnhandledExceptionFilter to catch. Then use MiniDumpWriteDump to dump exception to a file.
|
|
|
|
|
...or you could use longjmp which should be portable.
|
|
|
|
|
Hello All,
I made a service which keep track of logon, logoff, lock and unlock notification.. I want to extract the logged on user name when user logged on, lock or unlock system.. So i'm using GetUserName in respective cases, but it returns me "SYSTEM" every time..
What could be the reason?
Thanks...
|
|
|
|
|
Maybe because your service executes under the SYSTEM account?
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
Have you looked at the ISensLogon interface?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Environment.UserName will return the current user name
|
|
|
|
|
Thanks Everyone, I now used WTSQuerySessionInformationA
|
|
|
|
|
I installed a simple (and quite old application) on Windows 7 (UAC is enable) and it is not saved a simple text file (a simple LOG file) on C:\ !
I'm sure that the problem is related on UAC because disabling it the program runs well.
So, how to bypass the UAC and have the permission to write that file?
I suppose it can be also difficult to manage the registry, there is also in this case some special procedure to use?
thanks...
Russell
|
|
|
|
|
|
your app needs the rights to write this file. Runas or the Elevation moniker is needed.
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Hello folks!
The problem is as follows: our software relies on a 3rd party service. We noticed that this 3rd party service sometimes (on some computers sadly more than just sometimes) fails to startup correctly and it needs to be restarted to work with. This issue came up way too late for skipping to a different "platform" (so use another 3rd party's service) without having to do way too much work. As it seems, restarting the service "manually" fixes the problem. However, we can't expect our customers to do that every time our product doesn't work because of the 3rd party service not running correctly. We could try adding a program that runs and boot time or at the start of our product and restarts this service, however, you need to be an administrator to fiddle with it (and 99% of the users using the product will not be administrators). I was thinking of using CreateProcessAsUser[^], however, this would need the admin user's loginname and password every time, which won't do. So i was wondering if it was somehow possible, thorough some certificate or somesuch, to ask for the admin user's login information at install time (and later when this information changes thorough some setup program or automatically...) and then use it in following cases when the program is runned. Of course we could store the information in the registry or some file on the filesystem in a crypted-decryptable way but this would mean a HUGE security leak we just can't take.
Any ideas are welcome, thanks in advance...
p.s: and this should work on XP, Vista, Win7, ...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Computers are evil, EVIL i tell you!! <
|
|
|
|
|
Hi,
how to catch memory exception.
I am using delete[] operator for freeing memory.
The program hangs
Now i want to catch this exception.
|
|
|
|
|
Sakhalean wrote: how to catch memory exception.
Don't try. In almost all cases it's a bad idea. If the heaps corrupted handling the exception doesn't fix anything, it just makes things worse. Find the real problem, don't make new ones.
Steve
|
|
|
|
|
Are you even sure you get an exception if the program hangs?
|
|
|
|
|
No I want to catch this exception
without hanging the program
|
|
|
|