I'm working with a dialog based application in which the main dialog is used for logon operation.If the user id and password are correct the main dialog is closed(OnOk() is called) and a second dialog is created using DoModal().But the problem is that if i minimise this dialog its icon is not seen on the task bar just like internet explorer window which moves on to the taskbar on minimising it.In my application if i minimise my dialog the title bar of my dialog gets minimised and it moves on to the left corner of my screen and no information about that window is available on the task bar.How can i rectify it?
Senior Research Associate.
VLSI ASIC Hardware Design Group
Electronics R&D Centre,Trivandrum
// Set the icon for this dialog. The framework does this automatically// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
Override the dialog's ::OnPaint
// If you add a minimize button to your dialog, you will need the code below// to draw the icon. For MFC applications using the document/view model,// this is automatically done for you by the framework.void CMyDialog::OnPaint()
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangleint cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
And finally, as a protected member of the dialog class:
All of this will have been done automatically for your main dialog by the MFC AppWizard
I think you should consider the design of the program. You seem to go about the business backwards.
My suggestion is to open a modal dialog (the log-on dialog) from the OnInitDialog function of your main app. Your main app will then be displayed after returning from the log-on dialog.
Got ur problem...u hav 2 dialogs..and in a dialog based app u make ur default dialog login dialog and u create another dialog class to process after the login...the MFC gives all th esupporting code in to the first dialog ..and u want the same for second dialog..so u ask for some code for the minimisation and icon in Taskbar...there is no need of that..u just make the first dialog(MFC give al supporting code)as the dialog after login and u just create a second dialog class and use that in ur OnInitDialog() of the first..problem solved..!!!
somewhere on the web, i thought it was here on codeproject but i dont know it really anymore
i found an article frome someone who used a CFile and make it own crypted version of it and make it usable with CArchive. Did someone know this article. I dont find it anymore.
i am creating activex combobox using visual c++. i am facing one prob... i would like to know how to resize the combobox corresponding to its fontsize. whenever the fontsize or fontchanges the control has to resize not only the edit portion also the dropdown portion.
thanks in advance.
I created an MDI application. I dynamically create the document, and the child frame in an MDI applicaiton. However, the title bar in the MDI child frame is empty. I tried use pFram->SetWindowText(myTitle), but it doesn't work. How can I set the title for an MDI child frame programatically ?
I have some code to read the partition table. The structure is supposed to be 512 bytes to read from the disk and I have translated from the Pascal code the following structure to c++:
(The pascal code works fine as it is 512 bytes)
TPartEntry = record
boot_ind : Byte; // 0x80 - active
head : Byte; // starting head
sector : Byte; // starting sector
cyl : Byte; // starting cylinder
sys_ind : Byte; // What partition type
end_head : Byte; // end head
end_sector : Byte; // end sector
end_cyl : Byte; // end cylinder
start_sect : UINT; // starting sector counting from 0
nr_sects : UINT; // nr of sectors in partition
TDiskTable = record
Data : array[1..446] of Char;
Table : array[1..4] of TPartEntry;
Signature : WORD;
... to get this...
typedef struct tagPARTENTRY
BYTE bBoot; // 0x80
BYTE bHead; // starting head
BYTE bSector; // starting sector
BYTE bCyl; // starting cylinder
BYTE bSysInd; // What partition type
BYTE bEndHead; // end head
BYTE bEndSector; // end sector
BYTE bEndCyl; // end cylinder
UINT unStartSect; // start sector starting from 0
UINT unNumSects; // number of sectors in partition
typedef struct tagDISKTABLE
When I do a sizeof(DISKTABLE) it returns a size of 516 bytes. When I manually add up the values I get 512 bytes. Where are the other 4 bytes coming from and what am I doing wrong?
I have never used the #pragma pack and documentation is a little obscure as to how to use it. I was wondering if you could give me an example based on my sampel code which I provided in my previous post.
is it neccessary to clear or delete the handle from CreateEvent()?
if i just create a new HANDLE and hold with variable holding previous HANDLE from CreateEvent(), will there anything wrong after long run?
do you any method that i can check whether my event object still be in the kernel if i don't execute CloseHandle()?
in my case, i run CreateObject again and again, and put the return handle to cover the previous handle. so, i don't know the previous event object has been destroyed in kernel or not.
do you know any tools to check about this?
I have a simple requirement, I need to make an ActiveX EXE Server using ATL COM and call it from VB. I have to create a simple ATL Object and add a method to it which returns another simple ATL COM Object (which I have also created in the same project) to the caller. Although I can write simple methods using the wizard, I am unable to pass the second object.
I am quite new to VC++ and any help would be greatly appreciated.
If I understand what you are trying to say, why don't you just create the second object like you did the first, and just retrieve the IUknown pointer... That is to say treat it as you would treat other one as the first one.
What I was recommending is just create the new Object the same way you created the first one but apparantly by reading your new message I understand what you want to do is something a little different.
First of all you can't just return new Object and just cast that to IMyInterface*(If you want the reasons let me know). So what you need to create the first object with Aggretable support. Then create the second simple object using createInstance in the first Object(you will be passing the IUnkonwn* of the first object). Add the COM_INTERFACE_ENTRY_AGGREGATE() macro in the COM map. Dont forget to decrement the reference count when you dont need the second object(remember its still considered a COM object). No need to mess with IDL.
Note: There is a Macro similar to the above that takes care of creation and destruction.
If something is still unclear or need help with a specific part of the code let me know.
Last Visit: 31-Dec-99 19:00 Last Update: 4-Dec-21 12:50