|
The forums are a place for you to ask questions or look for comments. You really should have submitted this as an article. In doing such, you will also need to answer why your thread class is better than the one that MFC already has, as well as why it is better than ones that are platform-independent.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
I'm working on a WIN32 project and got stucked. I need dynamic menu... that is generated on the fly... so I have to #define a variable number of massages (one for every menu item) which I need in the WndCallback function to find out which menu item was clicked. I wandered is there is any repetitive macro directive... or some other way to do find out which item was clicked.
I hope I made myself clear... and look foreward to you solutions.
|
|
|
|
|
You don't need to #define an ID for each menu item, you can check it programatically in WM_COMMAND.
#define MENU_BASE WM_USER + 1000 // some made up number
#define NUM_ITEMS 20
char itemName[40];
for (int i = 0; i < NUM_ITEMS; i++ )
{
wsprintf( itemName, "Item %i", i );
::AppendMenu( hMenu, MF_STRING, MENU_BASE + i, itemName );
}
Then in your WndProc:
case WM_COMMAND:
{
int id = LOWORD( wParam );
if ( id >= MENU_BASE && id < MENU_BASE + NUM_ITEMS )
{
int item = id - MENU_BASE;
}
}
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
Thank you a lot. I can do it from here. Thanks again *one virtual beer for Steve Echols*
|
|
|
|
|
Hello,
im serching for a zip and unzipper which is written in c. It is very important, that there are only dependencies to standard-libs exitsts. No MFC ore something else. A other condition is those that it must be possible to compress and uncompress string(char*). This is also that, for which I need it.
I hope someone can me help
thanks in advance
|
|
|
|
|
There are loads of free zipping utuilites around, try http://www.zlib.net/[^] http://www.gzip.org/[^]
Don't worry about compressing a string. Nearly all zipping libraries take a file as a byte stream, which is basically a char*. But if you are hoping to compress text with a zipping util, you won't really gain anything. Zips are for compressing binary data, the algorithms expect certain paramaters to be present which are not found in plain text strings. To compress text you need a will be better off with a special text compression algorithm.
-- modified at 15:17 Tuesday 14th November, 2006
|
|
|
|
|
WalderMort wrote: But if you are hoping to compress text with a zipping util, you won't really gain anything.
??
text compresses just fine with ZIP / deflate. it's easy to get 3:1 compression with WinZip's default settings on a plain text file.
|
|
|
|
|
WalderMort wrote: But if you are hoping to compress text with a zipping util, you won't really gain anything.
It all depends on just how large the string is. Obviously a single 80 character string will not "usually" compress well unless it is already redundant in content, where-as an entire document loaded into a single string and then compressed would "usually" result in a very nice savings.
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
sknobli wrote: im serching for a zip and unzipper which is written in c.
If you really, REALLY want zip/unzip then get the zlib[^] API and use it, otherwise if you want small string compression, portibility and speed, go for the LZO[^] library.
As you get used to the compression and decompression methods and advantages/disadvantages of each, you may find that other [^] algorithms work better.
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
Jeffry J. Brickley wrote: go for the LZO[^] library
nice... except for those three magic letters GPL. it's like poison.
|
|
|
|
|
Commercial licenses are available on request. - you have to pay for the potent version!
[edit]Bah. I missed "free" in the original requrest. [/edit]
--
Presented in BC [Brain Control] where available
|
|
|
|
|
|
At first, thanks for all replies. Nevertheless, i need a zip-decompression which i use without windows.h and wchar.h. There is only a limited libary availible (for Nintendo DS). Exists any chance to get sourcecode from a project, which IN-Buffer is a char* and as OUT-Buffer is a Struct or something else which i can handle with my own I/O to write it to my FS. The reason why i want to handle a ZIP-File is that i want to modfie the date under Windows.
|
|
|
|
|
Hi All,
I have some queries regarding font.
Q1. What is exactly a 'Bitmap Type Font', 'TrueType Font'?
Q2. Difference between the two.
Q3. Difference between 16-bit version and 32- version of a Font?
q4. How can we identity whether a font is 16-bit version or 32-bit?
Anwsers to any of the above will be great help for me.
Thanks in advance
Suraj
Suraj Gupta
|
|
|
|
|
|
How can i make a driver hyperthreading ....
i doent mean the single HT core but i need my driver working on a multi core
HT . Is it possible or not?
vineesh
|
|
|
|
|
How can I programmatically get the group(s) that the current user(the user account the applications is running on) is in? I can get the privileges, but i need the group(s). Thanks for any help.
--yeti
|
|
|
|
|
EpicYeti wrote: How can I programmatically get the group(s) that the current user(the user account the applications is running on) is in?
NetUserGetGroups() comes to mind. If you want local groups, use NetUserGetLocalGroups() .
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
|
Hi all,
I have a loop in my program, that is waiting for a client to connect via TCP/IP for example:
But the thing is, the application uses the cpu to the max (waiting for a client(s)).
<br />
printf("Waiting for client (press any key to abort)...\n");<br />
while(1)<br />
{<br />
if(kbhit())<br />
{<br />
exit(1);<br />
break;<br />
}<br />
....
}<br />
My question is, is there another way of running a loop so that it will use less cpu uasge?
Thanx in advance
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
Yeah, put Sleep(500) or something in somewhere, so it loops, takes a little rest, loops again, takes a little rest... and so on
|
|
|
|
|
Thank you for the help, I'll try it...
Regards
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
As a side note, using Sleep calls generally indicates a poor design and should be avoided.
What you really want is to receive an event when a client tries to connect. In which case, you would use one of the WaitForXXX methods (e.g. WaitForSingleObject, WaitForMultipleObjects).
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Hi Zac,
Thank you for the reply, I'll check those two methods out (WaitForSingleObject, WaitForMultipleObjects).
With these methods, can I still put all my code in the loop that one of these methods creates for example:
<br />
WaitForSingleObject(hHandle,INFINITE)<br />
{<br />
....
}<br />
Regards
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|