Hello
I get strange results form GetLasError in WinCe;
something like 1449435930, for example;
I use this:
{$include d:\lazarus\fpc\2.2.4\source\rtl\wince\wininc\coredll.inc}
function GetLastError:DWORD; external KernelDLL name 'GetLastError';
var
err: dword;
begin
MutexHandle := CreateMutex(NIL, TRUE, 'xxx');
err:= GetCeError;
if err = ERROR_ALREADY_EXISTS THEN BEGIN
SetForegroundWindow(FindWindow('xxx', ''));
CloseHandle(MutexHandle);
Application.BringToFront;
END ELSE BEGIN
.........
Am I missing something?
Why do I get those huge values from GetLastError?
Thanks for any helpMailing lists / fpc-pascal / 2009-10
Does GetLastError in WinCE work?
3 messages · 2 people · –
- Eepergola 2
- SSven Barth 1
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Is this the wrong forum?
Can anybody help with my question? If I should send it to another forum, please
tell me which one.
Thanks
epergola wrote 25 lines
Hi!
Show quoted text 23 lines
1. why do you use "{$include ...}"? Just add the unit "windows" to the uses clause of your program - if it isn't already
2. why do you redeclare "GetLastError" when you're already including the file which contains the import? (but the first point is more important)
3. why are you using "GetCeError" while you want to use "GetLastError"? ("GetLastError" is the correct one in this context by the way)
4. you can't use the "Get*Error" methods like this. You first have to check whether the result of "CreateMutex" is valid (e. g. check if it is "0" or "INVALID_HANDLE_VALUE" - I don't know which one is used here... please check the MSDN for this bit of info ;) ). If the check is not valid (e.g. "MutexHandle" is "0"/"INVALID_HANDLE_VALUE") THEN you can use "Get*Error".
I hope I was able to help you.
Regards,
Sven
