|
Hello,
I was trying to create a dialog containing a calendar, so I decided to use the Month Calendar proposed by VC++ in the control bar.
But during the execution, when I click the calendar and display the selected day, I remarked that the day was wrong, 12 days more than the day I effectively clicked ...
I search in the MSDN CD to find an example and install the CmnCtrl1 project.
The MSDN project calendar reacts in the same way, 12 days more as soon as you click on another day that the current day.
Do I miss something in the use of this control ? Is it bugged ? If yes, is there a solution/workaround ? Can I use it with Win2K ?
Thanks in advance
DD
PS : I use Visual Studio 6.0 with Win2K
|
|
|
|
|
In fact, I found the solution on another forum.
Here is the wrong code proposed by microsoft :
CString pDate;
CTime ct;
if( m_MonthCal_1.GetCurSel(ct) )
{
pDate.Format(_T("%02d/%02d/%2d"),ct.GetMonth(),ct.GetDay(),ct.GetYear());
AfxMessageBox(pDate); // just for testing
}
Here is the right code :
CString pDate;
SYSTEMTIME ct;
if( m_MonthCal_1.GetCurSel(&ct) )
{
pDate.Format(_T("%02d/%02d/%2d"),ct.wMonth ,ct.wDay, ct.wYear );
AfxMessageBox(pDate); // just for testing
}
The correct way is to use a SYSTEMTIME instead of a CTime type ...
DD
|
|
|
|
|
hi guys
anyone knows how to use functions in dlls in another dll.
i'm writing a small app which use some functions in a dll(dlla).but in dlla,i use some functions in another dll(dll2),
how to do?
thanks
johns
01/04
|
|
|
|
|
I belive it is same as calling methods in dlla from ur application.
My God is more powerfull Than Your God. (the line that divides the world)
|
|
|
|
|
That depends on how you are using the functions/class in the DLL and if one or both are MFC extension DLLs. There are articles on this site that can help explain it. If you email me directly and give me a better idea of what you have in mind I'll see how I can assist.
Happy programming!!
|
|
|
|
|
thank you all.
i have the problem solved.
thank you again!
|
|
|
|
|
As far as i know that MFC is a wrapper for all the win32apis
My question is CSplitterWindow is wrapper for which apis??
My God is more powerfull Than Your God. (the line that divides the world)
|
|
|
|
|
As far i know, CSplitterWnd is not a wrapper for any equivalent Win32 API.
Splitter window is a windows with more than one panes or child windows, and where each pane is usually a CView class derived window and thats application specific.
Muhammad Shoaib Khan
http://geocities.com/lansolution
|
|
|
|
|
My program needs to popup a dialog whenever the user prints to a particular printer. I have the printer driver setup to notify my application when it's being printed to, at which point I display the modal dialog. However, the the problem is the modal dialog is displayed BEHIND the application that is printing.
I tried using the obvious SetForegroundWindow function in the OnInitDialog function, and it then properly displays my dialog on top of all other windows, but only for the first time printing! After that all subsequent prints display my dialog behind the application printing again.
I also tried using SetWindowPos, SetFocus, ShowWindow, BringWindowToTop, and SetActiveWindow but nothing works.
Any ideas???
Rob Geiman
|
|
|
|
|
Post the code with SetWindowPos().
Kuphryn
|
|
|
|
|
::SetWindowPos(m_hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
Rob Geiman
|
|
|
|
|
There are several solutions. Try passing in &wndTop as the first parameter to SetWindowPos(). Try ShowWindow(SW_RESTORE).
Kuphryn
|
|
|
|
|
kuphryn, thanks for the suggestions.
Unfortunately non of them worked. The most is I get it popping up on top for the very the first time, and after that it's behind the other apps.
|
|
|
|
|
Figured it out finally!
I needed to use a bit different syntax for SetWindowPos. The line below finally worked although it set my window coordinates to 0, 0 which I don't think it should have. No biggie since a CenterWindow call fixes that.
::SetWindowPos(GetSafeHwnd(), HWND_TOPMOST, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE);
Thanks again for the help!
|
|
|
|
|
How do prevent multiple instances of a dialog based application? I have seen the article my Newcomer which relates to non dialog base applications. Someone even posed the question to him but he never responsed.
Thanks,
Steve
|
|
|
|
|
One solution is via a mutex kernel object. Check out MSDN.
http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/Q243/9/53.ASP&NoWebContent=1
Kuphryn
|
|
|
|
|
The mutex method works whether your application is dialog-based or not. You might also check out http://www.naughter.com/sinstance.html.
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
Thanks guys that should be enough to get me going.
Steve
|
|
|
|
|
Hi All,
can anyone tell me is there a way to obtain the count of GDI objects used by an application.Is there a way to obtain the count for individual dll's that are loaded by the application.I need develop code to check for the GDI count and close the application(or close all the windows opened by a dll) if the GDI count reaches beyond certain limit.
Thanks in advance
|
|
|
|
|
Raghunandan S wrote:
can anyone tell me is there a way to obtain the count of GDI objects used by an application
What OS do you want to use?
If it's WinXP (Win2K too, if I remember correctly), you use Task Manager (taskmgr.exe ). Go to View / Add columns and choose GDI Objects (the real names can be different - I translated them from Polish back into English). Then you can use Dependency Walker (depends.exe ) to try to find a DLL and a method used by Task Manager.
This article[^] may prove useful. Especially if you are using Win98.
modified on Monday, November 29, 2010 6:03 AM
|
|
|
|
|
my os os win2000 server.But i wanted to know if there is an API so that i can use in my code
|
|
|
|
|
Read the article I mentioned. This is what it says:
the GetGuiResources function from USER32.DLL returns either the count of USER or GDI objects used by a given process. This function is exported by USER32.DLL, but the GDI handles are created and managed by functions from GDI32.DLL because both GDI and USER were moved to the kernel (WIN32K.SYS) starting with Windows NT 4.0
I guess that you can use this function.
And take a look at the source code that comes with it (especially GDICount application).
modified on Monday, November 29, 2010 6:03 AM
|
|
|
|
|
I'm a progammer and wanted to create a bar code program,
but l couldn't found the class library or the method to assist
me on this project.
would someone point me to the right track please?
eager to.
ppe
|
|
|
|
|
|
I'm in the process of re-writing my straight Win32 API app to an MFC app.
My Win32 API app uses the mmsystem.h file with no problem whatsoever from \MSVisStudioNet\VC7\PlatformSDK\Include. It is a 175,167 byte file created May 02, 2001.
BUT, when trying to include and use mmsystem.h in my new MFC app, the compiler errors four times with "nonstandard extension used: nameless struct/union" at lines 1837, 1841, 1862, and 1866.
Could someone let me know what is happening here to cause the errors? Is there an MFC type version of mmsystem?? I did search the entire VC7 installation and only ONE mmsystem.h file exists...apparently there is no other to use?
My other includes are stdafx.h and afxdb.h (as the program access/uses an Access database).
Thanks!
Joe
|
|
|
|