|
Could it be GlobalFreePtr? I don't find any docs about these macros on the msdn (tell something new ).
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
Bluute tette!
|
|
|
|
|
GlobalFreePtr
Note that if you use Win32 there is really no need to use this. The Win32 memory archetecture does not keep a separate global heap. LocalAlloc and GlobalAlloc are the same, and both malloc and new eventually calls a similar function called HeapAlloc.
/moliate
Two o'clock and walking through familiar London - Or what was familiar London before the cursor deleted certain certainties -
I watch a suit and tie man giving suck to the Psion Organizer lodged in his breast pocket
its serial interface like a cool mouth hunting his chest for sustenance, familiar feeling, and I'm watching my breath steam in the air.
Neil Gaiman - Cold Colours
|
|
|
|
|
But is it harmless if you do use it?
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
Bluute tette!
|
|
|
|
|
Yes, but it is only included for Win16 compability. It is a macro for allocating memory and locking the handle, which is not nessicary in Win32. Unlike Win16 memory allocation methods, Win32 methods have very few efficiency differences.
MSDN says that if you decide to use GlobalAllocPtr, GlobalFreePtr should be used to release the memory. This is probably just for backward compability, but better safe than sorry...
Cheers
/moliate
Two o'clock and walking through familiar London - Or what was familiar London before the cursor deleted certain certainties -
I watch a suit and tie man giving suck to the Psion Organizer lodged in his breast pocket
its serial interface like a cool mouth hunting his chest for sustenance, familiar feeling, and I'm watching my breath steam in the air.
Neil Gaiman - Cold Colours
|
|
|
|
|
It's really strange when your application works perfect under debug version, and later when you switch to Release it crashes. Here is how it happens.
1) I use CreateProcess to start a program and wait untill it ends.
CreateProcess of course crashes under Win2k/XP.
2) Then I switch to ShellExecute. Same thing happens.
3) I don't want to use WinExec!
So what's the difference between WinExec/ShellExecute/CreateProcess, and if you can provide some working code with theese functions
Regards,
Deian
|
|
|
|
|
It is not surprising at all.
In dubug mode when you are using arrays or strings the compiler can reserve up to 16 bytes more that are actually needed. If you then write past the end of the memory and are still within that 'safe' area you will not have a problem. In release mode however even writing one byte past the end can cause a crash.
I would also take a careful look for memory and resource leaks some of which only cause an oject dump in debug mode but crash in release mode.
Happy programming!!
|
|
|
|
|
Check out this article
It will not tell you what is going on withe CreateProcess and ShellExecute but it will give you an idea about the differences between Release mode and Debug mode
Best regards,
Alexandru Savescu
|
|
|
|
|
Hi Deian,
Take a look at Surviving the Release Version.
Good luck!
- Jason
(SonorkID 100.611)
"I just recieved an email from myself but I didn't send it ?"
- Colin Davies, Sonork conference
|
|
|
|
|
Thanks a lot guys, I really appreciate it
Greetings,
Deian
|
|
|
|
|
Hi everyone!
I have to add an en-/decryption-algorithm into an (already existing) image processing application which uses the CImgEdit control by Kodak for displaying TIFF images. In order to implement the algorithm on the images I need direct access to the image data.
It would be easy to en-/decrypt the whole TIFF file. But due to reasons beyond my influence ONLY the image itself should be en-/decrypted, so that an encrypted TIFF file can be opened with any TIFF viewer but pixel-waste is all that is displayed...
Another point is, that I'm not allowed to write the decrypted image data onto disc but have to do any decryptions in memory solely.
Many thanx to anyone who can help me with this problem.
Best regards,
Andreas
P. S. I'm new at CodeProject and very hopeful someone will provide me the help I need
|
|
|
|
|
Hello guys, I'm experiencing a strange behaviour in one of my programs. I use mutex to prevent two copies of my program running at the same time. Under win 9x/Me works fine, but under Win2k and XP don't. Any ideas why? Any advice, code sample or link appreciated
|
|
|
|
|
Actually there should be no reason why it should not work.
You could post the code snippet, that would be more helpful
to see your problem
|
|
|
|
|
Thanks for the reply . I'm not currently at home, so I can't post the code today. But the method is the following:
declare a mutex, try to open it, if it's not there than this is the only copy -> create a mutex -> release it on exit, if the mutex is there, exit
|
|
|
|
|
Hi Deian, i have no clue about your problem (too little information).
But it seems like your function is trying to do the same as CreateMutex which delivers a named mutex, if the object allready exists then you get that object, if not, the system creates a new object and that is the one you get.
CreateMutex is the function you should use to initialize a mutex, the description you gave is NOT threadsafe (another thread could create the mutex in between "try to open it, if it's not there than this is the only copy -> create a mutex").
"It could have been worse, it could have been ME!"
|
|
|
|
|
|
Hi !
I try to print documents from Pocket PC (Palm Size) on portable printer via IrDA. The PSPC define in wce.h disable all printing API ; so I try to use IrCOMM with socket to communicate with printer, but after connecting, I don't know what to tell it !!!
Does anybody have any suggestions ?
Thanks in advance...
Emmanuel Derriey
|
|
|
|
|
I have a Voice/Data/Fax Motorola SM56 Modem. I want to write a program ex Voice Mail Program on this modem. And I use Visual C++ language and TAPI support of Windows. I want to playback a WAV File, PCM 8000Hz, 8bit Mono , using some function of Windows ex waveOut, waveIn. When I play in Sound Card, it's OK. But when I play in Modem, it notice that this device does't support this file structure. I can't do it. Help me, please.
And If who have this program, include Source Code, please send me.
Thanks.
Mr HADP
|
|
|
|
|
How do I change IP Address programmatically. I'm on W2k Server.
Thanks
Kannan
|
|
|
|
|
Just found a sample on platform sdk.... (ipchange).
thanks
Kannan
|
|
|
|
|
I have two dialog and I have two public char parameter in each of them.I create.I define both of them like this:
char pszBuffer[MAX_PATH];
and
char pszpath[MAX_PATH];
Now I want to create second dialog and pass first char to second one and I do it like this:
aDlg.pszpath = pszBuffer;
But I et this error:
error C2106: '=' : left operand must be l-value
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
|
|
|
|
|
What you have defined are two char arrays. To copy the content of one array to another you must use one of the string copy routines like strcpy.
Martin
|
|
|
|
|
Thanks Martin
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
|
|
|
|
|
You could declare pszPath as a pointer instead of array ;
|
|
|
|
|
if you do an assignment of pointers then one change in the source will affect the destination also. Also if the destination goes out of scope you will most likely end up with an access violation.
Always copy the content in the destination via strcpy or memcpy
Best regards,
Alexandru Savescu
|
|
|
|
|
Anyone have any ideas how to access resources linked into a static library? In a MFC dialog application, I am trying to access the dialog template and supporting class from a static library and not having much luck. I have verified that the resource has been compiled into the library and the library is in the path.
The goal is to be able to distribute just a library and the header file for use in other applications, similar to the way CFileDialog works (add header file, instantiate CFileDialog and you're good to go). There may not be a way to do this since I suspect the resource compiler only comprehends a single resource file; but if anyone would know how to do this, it would be a codeproject member.
Thank you for any help.
severehammer@yahoo.com
|
|
|
|