|
|
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
|
|
|
|
|
infonaut wrote: I wish to launch an external application [TTools.exe] from within my simple win32 console app.
Search for CreateProcess at CodeProject!
|
|
|
|
|
|
Thanks Mike & Sceptic
|
|
|
|
|
Hello,
I have created a SDI with CFormView as the view (VC++6). I would like to add some code to do something when the 'X' button of the document is pressed.
In a Dialog box we process the WM_CLOSE message.
Please can you tell me how to do it in a SDI document?
Thanks.
Fortitudine Vincimus!
|
|
|
|
|
Process the WM_SYSCOMMAND[^] notification; look for wParam set to SC_CLOSE .
Software Zen: delete this;
|
|
|
|
|
Thank you for your reply.
I tried to process the WM_SYSCOMMAND in MyAppDoc.cpp and then in MyAppView.cpp, but it is not working. The command is not even listed in the class wizard.
What do i do?
Fortitudine Vincimus!
|
|
|
|
|
You'll need to add an OnSysCommand() [^] handler to your view class, and look for the nID value to be set to SC_CLOSE . If you're writing an SDI application, you can also process this command in your CFrameWnd -derived[^] class.
Software Zen: delete this;
|
|
|
|
|
The view is a CFormView. Would that be any problem.
I added OnSysCommand() in my CFomView class. I put a message box there. But it seems like the control just does not go there. Sigh!!
Fortitudine Vincimus!
|
|
|
|
|
The 'X' button is on the frame window not the form window. Try handling it in the frame window
class instead.
Mark
|
|
|
|
|
I added the WM_CLOSE command in my MainFrame class.
But now the problem is that I am not able to retrive data from the input boxes of my CMyFormView.
The program Asserts when GetWindowText is called.
void CMainFrame::OnClose()
{
CMyFormView pFV;
pFV.OnAppExit();
CFrameWnd::OnClose();
}
<p\ pre="">
<div class="ForumSig"><hr><font color="brown">Fortitudine Vincimus!</font></div>
|
|
|
|
|
How about this...
void CMainFrame::OnClose()
{
CMyFormView *pFV = (CMyFormView *)GetActiveView();
pFV->OnAppExit();
CFrameWnd::OnClose();
}
|
|
|
|
|
Yipee!! It worked!! Thanks a billion!!
GetActiveView() - so thats the way. Create an object of the view and then set the focus on it.
Thank you once again.
Fortitudine Vincimus!
|
|
|
|