|
Hello,
Thanks I will try that.
Prithaa
|
|
|
|
|
prithaa wrote: Thanks I will try that.
Look up CFrameWnd::LoadFrame to see how they are doing it. You might get some more help.
Carry on.
|
|
|
|
|
Hello,
I tried it.
But still te compiler refuses to create the frameWnd and the error arises where the compiler wants the menu through
::SetMenu(m_hWnd, pMenu->GetSafeHmenu());
and the menu is not provided.
And in your code snippet the SetMenu is called after the window is created then what will be the default menu
Prithaa
|
|
|
|
|
prithaa wrote: I tried it.
But still te compiler refuses to create the frameWnd and the error arises where the compiler wants the menu through
::SetMenu(m_hWnd, pMenu->GetSafeHmenu());
and the menu is not provided.
And in your code snippet the SetMenu is called after the window is created then what will be the default menu
Show me your code. Just pass in a NULL for menu. Later on set it.
|
|
|
|
|
Hello,
thanks Sir
But where should I pass the NULL for menu since I see
no parameter for menu before creating the frame window.
We AfxRegisterWindow() without menu parameter and Create() without menu parameter.
Here is the code snippet.
CMDIFrameWnd* pFrame = new CMainFrame;
m_pMainWnd = pFrame;
CMenu m_Menu;
LPCTSTR lpctszClass = AfxRegisterWndClass(
CS_HREDRAW |CS_VREDRAW,
LoadCursor(IDC_ARROW),
GetSysColorBrush( 1 ));
m_Menu.CreateMenu();
m_Menu.InsertMenu( 0, MF_BYPOSITION | MF_STRING, 1,
_T( "Demand" ));
pFrame->Create( lpctszClass, _T( "Demand Frame" ),
WS_OVERLAPPEDWINDOW,
CRect(0,0,0,0), 0, 0, 0, 0 );
pFrame->SetMenu( &m_Menu );
return TRUE;
Pritha.
|
|
|
|
|
How can i close file handles used by another processes ?
|
|
|
|
|
Can you more example what applications?
|
|
|
|
|
nitinmx wrote: How can i close file handles used by another processes ?
I'm not sure why you’d want to but as far as I know they answer is no, or at least not easily. The only way I can think of to achieve this is to get the owning process to close the HANDLE for you via code injection: by using SetWindowsHookEx for example. Again, doing this is dubious to say the least.
Steve
|
|
|
|
|
Hi,
I'm working under VS 6 C++ and need to parse date from YYYY-MM-DD HH:MM:SS to any of SYSTEMTIME or tm structures. I'm struggling to use CTime, because it requires to run under MFC(does it? ) and I'm creating a COM object. Or is there a way to use CTime while creating COM ?
PS : I'm not having problems with parsing "YYYY-MM-DD HH:MM-SS" formated string into Int values and filling them into e.c. SYSTEMTIME structure, but I don't know how to compare two dates created that way. When I try to create FILETIME from SYSTEMTIME (to be able to compere them) using SystemTimeToFileTime(...) method, it doesn't work corretly. I suppose it's beacuse of the source SYSTEMTIME doesn't have all fields set (Day of Week and MILISECONDS - which are for me irrelevant, I can set miliseconds to zero but I don't know how to determine day of week)
thanx for any ideas
|
|
|
|
|
I dont know exactly what your problem is, but maybe this will help
SYSTEMTIME ST;
GetLocalTime(&ST);
CString TimeStamp;
TimeStamp.Format("%ld-%ld-%ld%ld:%ld",ST.wYear,ST.wMonth,ST.wDay,ST.wHour,ST.wMinute);
Note that you might have to make a simple function which adds a 0 infront of some of the variables for it to look nicer
//Johannes
|
|
|
|
|
You can use CRT function mktime() to make a time_t, and then you can do everything you want. Take a look at CTime's source. (c:\Program Files\Microsoft Visual Studio\VC98\MFC\SRC\TIMECORE.CPP )
|
|
|
|
|
Zilo(svk) wrote: I'm struggling to use CTime, because it requires to run under MFC(does it? )
You can also use ...
_tcsftime
|
|
|
|
|
|
...or just use strcmp() if you just need to compare times. It will work on the format you supplied, and it's faster than any conversion you can make. If you're about to make alot of comparisons (like sorting) converting it to a number might be the way to go.
|
|
|
|
|
Hi. I love using this forum, you guys are my salvation!!
The question I have know, is that:
When I run the program if I push the Enter button the app is closed. I don´t care if I push the Enter button and it calls the OK button in my app, but it doesn´t happen. Pushing Enter is just like pushing Escape. How can I fix this?
Thanks everybody!!
|
|
|
|
|
Take a look at http://visualcpp.net/index.php?qID=28
//Johannes
|
|
|
|
|
Set the "Default Button" property of the button to False(From the property window). You can set the default property to true which ever button handler you want to execute on pressing enter Key.
Anurag Gandhi.
|
|
|
|
|
Double Click to Add the event handler for OK Button.
Add the Following code in the function:
if(0x8000 & GetKeyState(VK_RETURN))
return;
OnOK();
Now, Your Dialog Box will not Quit even if Ok Button is set to focus.
Anurag Gandhi.
|
|
|
|
|
Thanks for answering anurag. There is another problem.
The button I set as Default Button is a CImageButton, so it has the Owner Drawn property set to TRUE. When I click the Default button property it loses the Owner Drawn property and with it, his image. Moreover, it is useful for me on secondary Dialogs, but in the main dialog I have no default button, and don´t want nothing to be as default, I need nothing to happen when I push the Enter button. is there any other solution?
Thanks again
|
|
|
|
|
It still does not work. When I press Enter it does not get into the procedure asigned to the OK button.
I wanna cry...
|
|
|
|
|
If you want nothing to happen when you press Enter Key (It's Enter Key, not Button).
Use the following code at the begining of all the Button event handler functions:
if(0x8000 & GetKeyState(VK_RETURN))
return;
This code will return from the function whenever you will press enter key.
I think this will help you.
Anurag Gandhi.
|
|
|
|
|
hi!
try pretranslatemessage function...
BOOL CDlg::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->wParam == VK_RETURN) // if enter key pressed return true
return TRUE;
return CDialog::PreTranslateMessage(pMsg);
}
hope it helps...
newbie
|
|
|
|
|
This is a good idea Newbie,
But it will block Enter Key through out the dialog box. Not only for Some Buttons.
Anurag Gandhi.
|
|
|
|
|
THANK YOU!!!
THIS IS THE BEST FORUM I´VE EVER VISITED. That worked!
Thank you ginjikun.
|
|
|
|
|
It is not recommended to override PreTranslateMessage() for this purpose.
The reply in This thread is fine.
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|