|
Oliver123 wrote: I have looked at the format directives for sprintf, but don't see anything obvious.
Any reason why you don't use \n in the format specifier?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I tried that. Also tried \n\r.
\n yields a bold vertical bar in the resulting single line of text.
\n\r yields two bold vertical bars.
|
|
|
|
|
Of course it does. What else would you expect it to display since a list control is not meant for multiple lines. If you must have multiple lines, use an edit control with the ES_MULTILINE style.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I guess I have been using the wrong tool for the job. The edit control works much better. Thanks.
|
|
|
|
|
Hi
This code closes the window with PostMessage.
But if i write SendMesssage instead of Post message it doesn't close the window.I don't understand why it is so.
HWND h=::FindWindow(NULL,L"Tutorial: A Simple Window - Mozilla Firefox"); <br />
PostMessage(h,WM_QUIT,0,0);
What are the differences so postmessage can close the window but postmessage can not.
Thanks
Edit/Delete Message
|
|
|
|
|
From MSDN 2005;
Do not post the WM_QUIT message using PostMessage; use the PostQuitMessage function.
Postmessage just dumps it in the queue, if it fails you miss the error it raises.
Sendmessage waits until it gets a return value.
Hope that helps
|
|
|
|
|
Check out the remarks section of the SendMessage() API. SendMessage Function[^] and how
it's handled across threads.
Across processes PostMessage is a better idea IMO. If you need to wait until it closes then
maybe wait until FindWindow() fails.
Mark
|
|
|
|
|
Posting a WM_CLOSE message is the right way to close a window. WM_QUIT will make the message loop stop right away, without giving the app the chance to properly shut down.
|
|
|
|
|
|
i know how to get the current time and date i need to know how to add 10 hours to it.
CTime t1;<br />
t1=CTime::GetCurrentTime();<br />
GetDlgItem(IDC_MINE)->SetWindowText(t1.Format("%A, %B %D, %y, %H:%M:%S"));
or if i knew how to set the timezone i could use another CTime and just use 2 for what i need and how to convert it to 12 hour format
ok i think i have it but i still dont know how to get it to 12 hour format.
-- modified at 15:00 Sunday 22nd October, 2006
|
|
|
|
|
Try %I instead of %H in the hour portion to get 12 hour format.
Jeron
|
|
|
|
|
thanks dude worked like a charm.
where can i find all the %H %I %P and so on in msdn?
|
|
|
|
|
|
CTime t1 = CTime::GetCurrentTime();
t1 += CTimeSpan(0,10,0,0);
|
|
|
|
|
that looks simple enough but i just used
CTime t2;<br />
t2=CTime::GetCurrentTime()+36000;
|
|
|
|
|
Hi, I'm using MSDN 2005. I have set up serialization of a list. If I use the open file command and try an reload a file that is already in memory, is does not enter into the ::Serialize(CArchive& ar). I'd like it to force a reload, as I have a separate function that imports a text file, and if I try reload a file that it thinks is in memory, but isn't, it doesn't work. Any help much appreciated.
Cheers
Colin
|
|
|
|
|
I have tried to lookup a conversion of a char to wchar_t, only found the other way around.
//my code
WCHAR* FileType;
char buffer[512];
ifstream inn;
inn.open("SkyWorld.ini");
string buffer1;
getline(inn, buffer1);
sprintf(buffer, "%s", buffer1.c_str());
// now buffer to FileType, or if possible, string to wchar_t so i can save 1 stepp.
thanks
|
|
|
|
|
FileType = new WCHAR[strlen(buffer) + 1];
MultiByteToWideChar(CP_ACP, 0, buffer, -1, FileType, strlen(buffer) + 1);
Mark
|
|
|
|
|
worked like a charm , thanks
|
|
|
|
|
I wrote a service that loads a dll for global hook purpose using SetWindowsHookEx function with WH_KEYBOARD_LL parameter.
It is defined to run automatically on system startup and to interact with the desktop, as well.
It works fine till I upgraded XP to XP SP2. The service starts successfully in manual mode but not automatically on system startup.
The event viewer reports the errors event id 7009 and 7000 from the Service Control Manager.
Event ID: 7009 Source: Service Control Manager Description: Timeout (120000 milliseconds) waiting for service to connect.
Event ID: 7000 Source: Service Control Manager Description: The Certificate Authority service failed to start due to the following error: The service did not respond to the start or control request in a timely fashion.
After commented out the hooking function I saw that the services started on system startup.
Is there anything that you know regarding to global hooking on XP SP2 that prevent from my service to run on system startup?
Thanks,
Dudi
|
|
|
|
|
Is there any alternative to StretchDIBits() ? I am drawing transparent bitmaps using a masked bitmap alongside the SRCAND and SRCPAINT raster operations, but it's terribly slow. I was previously using TransparentBlt() specifying the color mask, which had a reasonable speed. I always thought using DIB's was faster, but that obviously isn't the case. Could anybody suggest how I might be able to make this drawing faster?
|
|
|
|
|
From what I remember, SetDIBitsToDevice is way faster than StretchDIBits.
But of course that was comparing "straight copy" to "copy and reduce height to 0.95 of original". Do you need to stretch? I would have expected "StretchDIBits" to reduce to "SetDIBits" if sizes are the same.
|
|
|
|
|
I have created a DIB wrapper class which will directly manipulate the pixels of a given bitmap. I am now trying to code GetPixel and SetPixel functions. The GetPixel function works without any problem, but I have a few questions regarding Setting of pixels.
In the case of 1,4 and 8 bits per pixel bitmaps, the colors are stored in a color table (an array of up to 256 RGBQUADS). Given an arbitrary RGBQUAD/COLORREF how is it possible to find the closest matching color from within that array?
|
|
|
|
|
Never mind, I didn't realise there was a GDI function to do this GetNearestPaletteIndex() . All I needed to do was to create a palette and let the GDI do the hard work.
|
|
|
|
|
Hi Folks,
A newbie question ...
I wish to launch an external application [TTools.exe] from within my simple win32 console app. My program is generating text files that will be used by this other program. I need to use the following syntax to launch the app ...
TTools.exe /co"MyPlans" /tf"C:\MyDir\" /ep
The program will open, do its job and close without user interaction required unless an error occurs (/ep switch).
Platform WinXP.
Microsoft Visual Studio 2003.
Any advice would be most appreciated.
Rod
-- modified at 6:10 Sunday 22nd October, 2006
|
|
|
|