|
- sleep - Second resolution, and implemented using signals (a SIGALRM is used)
- usleep - Microsec resolution, implemented using a realtime timer. This has actually been deprecated and you should use 'setitimer'
- nanosleep - Nanosecond resolution, implemented using a realtime timer.
Use the one most appropriate - if you are sleeping in whole seconds, then 'sleep' is fine, otherwise you'll need one of the other for more accurate sleeping. Another method of sleeping is to use 'select' with a time specified (in seconds and microseconds), which has the advantage of you also being able to read from sockets etc
|
|
|
|
|
Thanks, Johnny buddy!
Geo
|
|
|
|
|
hi...
can someone please tell me the meaning of this error?
error C2440: 'initializing' : cannot convert from '' to 'class CString'
i get this error when i try to
do
CString temp = m_panotherClass->GetStringData()
my
anotherClass has this definition
CString GetStringData()
{
return data;
}
tks for the help
Have a Super Blessed Day!
-------------------------
For God has not given us a spirit of fear, but of power and of love and of a sound mind.
2 Timothy 1:7
"For God so loved the world that He gave His only begotten Son, that whoever believes in Him should not perish but have everlasting life."
John 3:16
"Therefore you also be ready, for the Son of Man is coming at an hour you do not expet."
Luke 12:40
|
|
|
|
|
Depends on what 'data' is.
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
data is CString
Have a Super Blessed Day!
-------------------------
For God has not given us a spirit of fear, but of power and of love and of a sound mind.
2 Timothy 1:7
"For God so loved the world that He gave His only begotten Son, that whoever believes in Him should not perish but have everlasting life."
John 3:16
"Therefore you also be ready, for the Son of Man is coming at an hour you do not expet."
Luke 12:40
|
|
|
|
|
Hi,
I have a program that generates a window depending on user settings. The window contains a bitmap that the user selects, and can have various border types (dialog, client edge, no border), and may or may not have a title bar.
The window is supposed to be the size of the bitmap that is selected. However, I have just realised that my window size does not take account of the titlebar or border of the window.
For instance, I calculate my window position and size like this currently:
<br />
BITMAP BMPSize;<br />
HBITMAP SizeCheckBMP;<br />
....<br />
GetObject(SizeCheckBMP,sizeof(BMPSize), &BMPSize);<br />
....<br />
xpos = (GetSystemMetrics(SM_CXSCREEN)/2)-(BMPSize.bmWidth/2);<br />
ypos = (GetSystemMetrics(SM_CYSCREEN)/2)-(BMPSize.bmHeight/2);<br />
width = BMPSize.bmWidth;<br />
height = BMPSize.bmHeight;<br />
....<br />
myWnd = CreateWindowEx(<br />
WS_EX_TOOLWINDOW,<br />
"my_win_class",<br />
WS_DLGFRAME,<br />
NULL,<br />
xpos,<br />
ypos,<br />
width,<br />
height,<br />
NULL,<br />
NULL,<br />
hInst<br />
NULL);<br />
The problem here is, suppose the bitmap is 640x480 pixels in size - the window created by this code will be exactly that size too, which doesn't work if there is a title bar and border, as these will be included in these dimensions. So the bottom of the bitmap will be cut off by the exact number of pixels that the titlebar takes up, or the right and bottom of the bitmap will be cut off by the number of pixels that the dialog frame border takes up. I hope that makes sense.
Could someone please suggest a better way of calculating my window size so that it sizes itself to exactly fit whole of the bitmap, plus the title bar and border?
Many thanks for any help,
KB
|
|
|
|
|
|
Hey, I'll have to remember that one!
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
|
Brilliant, thank you! Both suggestions work great, but I've used AdjustWindowRectEx because it requires less code...
Thanks again,
Keith
|
|
|
|
|
Use GetSystemMetrics to get the height and/or width of the various window components, and add them to your dimension calculations.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Actually, Mike's method is better.
""It is impossible to rightly govern the world without God and the Bible." -- George Washington
FLUID UI Toolkit
|
|
|
|
|
What's wrong with my code? the first queried value works but the second one does not. What's the problem?
char Desktop[500];
char Programs[500];
char CurDirectory[500];
GetCurrentDirectory(1000, CurDirectory);
HKEY hKey;
DWORD dwBufLen1, dwBufLen2;
if (RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
{
RegQueryValueEx(hKey, "Desktop", NULL, NULL, (LPBYTE) Desktop, &dwBufLen1);
RegQueryValueEx(hKey, "Programs", NULL, NULL, (LPBYTE) Programs, &dwBufLen2);//doesn't work!
}
RegCloseKey(hKey);
-- Steve
|
|
|
|
|
|
I wonder if someone knows how i can get the same behaviour in a
CListCtrl or CTreeCtrl or any other control, that the searchresult ctrl
has in Kazaa.
I want a tree ctrl with multicolumn and the possibility to drag and drop
the columns.
And the expandable part, the +/- signs, should always be in the first column.
I almost found this in a ctrl on codeproject, but when the first column
was moved the +/- signs where moved to, not pretty.
It looks to me that Kazaa uses a CListCtrl with tree capabilities, but i'm not sure.
And if it is, how can i get it in my application?
I hope that someone knows what i'm talking about, and can help me.
|
|
|
|
|
Hi,
Usually when the computer is not connected to the net the interface in My Network Places appears Disconnected ("Network cable unplugged"). Is there a way to tweak the registry to bring up the interface without being connected to the net?
The reason I want to do this is because I have on my computer a win xp and linux. I run linux in VMWare. In linux I have a server and on windows the application that has to connect to the server.
Thanks
-----
We are what we repeatedly do. Excellence, then, is not an act, but a habit.
|
|
|
|
|
well, if you dont have another machine you can :
connect the cable to a sheap 10Mbp hub
or
you can insert a second network addapter in you machine and connect the two with a crossover cable
MSN:maxsnts@hotmail.com
|
|
|
|
|
Dear All
Could anyone please let me know how to print jpeg/bmp images in vc++?
When i do so, i get the image in the top left corner of the page,very small size.
I use the mm_loenglish mapping mode.
Alternatively can i use cximage for printing?but how do i do?
Would be great if u cud help me..
Thankyou very much.
|
|
|
|
|
You're problem is probably related to the page size / dpi of the printer. Printers typically have very large pixel counts - 300 dpi or more. You need to use GetDeviceCaps to get the vertical and horizontal pixel counts of the printer and scale your image accordingly.
|
|
|
|
|
I tried printing, but perhaps am making some mistake..
Could u please give me an example of how to do?Should i use it in onprepareprinting?Wud b great if u cud help me.
Thankyou.
|
|
|
|
|
Hi,
I've made a key accelerator for my program (I did it by using the resource view), and I want to 'attach' it to my windows. How can I make sure that the accelerator table is associated with the window?
Thanks
|
|
|
|
|
If you're using MFC, and the window in question is a frame window (derived from CFrameWnd ), it already has support for accelerators. To make the frame window load the accelerator table at the same time as the menu and other resources, give it the same resource ID as the menu and use LoadFrame to create the frame window.
If you want an alternate set of accelerators, use LoadAccelTable .
For a non-CFrameWnd window, you'll need to call LoadAccelerators to load the table, and insert a call to TranslateAccelerator in an override of PreTranslateMessage , returning TRUE if TranslateAccelerator does.
I don't know enough WTL to offer a suggestion.
If you're using the raw Win32 API, insert a call to TranslateAccelerator before your call to TranslateMessage in your message loop.
|
|
|
|
|
Hi,
I need to build some kind of app which, display a picture and after 10 seconds the next, etc......
To do that, I'll need some kind of timer conrol (like the Timer in .NET), is there something like that in MFC. If there is (I thinks there is), can somebody tell me how to use it?
Thanks
|
|
|
|
|
There is a sleep function that you can use. I just use it as a puase between command, so if i think you want to use it for the same purpose it would be ok. Maybe you can display the first pic, then sleep, then remove the first pic and display the second pic?
Sleep(time)
btw, time is in milliseconds.
Jimmy
Just cause I am 15, doesn't mean I'm dumb! (I'll really be 4 on Feb. 29...the year 2004)
|
|
|
|
|
Sleep is a blocking call. No Windows messages can be processed while your thread is blocked. This means that the rest of the user interface will be very unresponsive.
If you don't need the timer to be very accurate, use SetTimer to have Windows send you a message when a timer expires.
|
|
|
|
|