|
And then call RedrawWindow() with the RDW_INVALIDATE, RDW_FRAME, and RDW_UPDATENOW flags.
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
|
I am developing a property sheet-based application on XP using VC++ 6. When it starts it talks briefly to an instrument over a serial port in app::InitInstance(), creates the property sheet, adds a few pages, and does an appSheet.DoModal() to make it appear. In order to get an icon to appear in the taskbar and Alt-Tab, I use this code in appSheet::OnInitDialog():
AfxGetMainWnd()->SetIcon(AfxGetApp()->LoadIcon(IDR_MAINFRAME), TRUE);
AfxGetMainWnd()->SetIcon(AfxGetApp()->LoadIcon(IDR_MAINFRAME), FALSE);
The app works just fine, and until I added a slight twist mentioned next the icons appeared as expected.
For the several seconds during which the app is initially talking to the instrument the user sees nothing happening. So at the beginning of app::InitInstance() I create a modeless dialog that asks the user to be patient while the app starts up, and then hide the dialog at the end of the startup property page's OnInitDialog(). This works fine and looks great. Except that now SetIcon(), above, returns 0 and I get the generic white window icon for Alt-Tab and nothing in the taskbar. The icon in the title bar is still correct.
If I use the following code in place of the previous code, I can get the icon to display when I do an Alt-Tab, but nothing shows up in the taskbar.
HICON hIcon=AfxGetApp()->LoadIcon(IDR_MAINFRAME);
CWnd* pFrame=AfxGetMainWnd();
::SetClassLong(pFrame->GetSafeHwnd(), GCL_HICON, (long)hIcon);
Interestingly, until I do this the generic MFC icon shows up in the taskbar.
Any ideas why this is happening and how to get my icon and app name to appear in the taskbar?
Thanks
|
|
|
|
|
What are the values returned by the SetIcon() method? It could be that your modeless dialog has the icons locked while it is displayed?
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
SetIcon() returns 0 (zero) rather than a handle to an icon.
I'm not sure what you mean about the application's icons being locked by the modeless dialog; how would I investigate this possibility? And if this is the case, can I make the dialog unlock them? The dialog lives as long as the app and is hidden or displayed, with different messages, as I change modes while communicating with the instrument.
|
|
|
|
|
rfparker wrote: SetIcon() returns 0 (zero) rather than a handle to an icon.
So SetIcon is failing.
I would suggest that you take the communication and startup dialog code out of your InitInstance() function and put them in a separate function so that your app can be properly initialized before you do anything else. One way is to post a custom message to your main window at the end of InitInstance() and do the communication from the message handler.
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
Yes, that might be a better way to do it (though AppWizard puts the call to DoModal() in a dialog-based app's InitInstance()) and I've made that change. It makes no difference to the functionality that I see.
Since I can get the correct title bar and Alt-Tab icons to appear by setting them in the property sheet's OnInitDialog(), the real issue is the button on the taskbar. I guess the modeless dialog is considered the main window for the task (it has to be created first), since when it is displayed the button appears and as soon as it is hidden (SW_HIDE) the button disappears. So I can't hide the modeless dialog without also disappearing the taskbar button. So for now I'm not hiding the modeless dialog, which is undesirable.
There is also the issue of the initial icon on the taskbar button. I've added SetWindowText() to the modeless dialog's OnInitDialog() to set the proper caption, since there's no title bar, and added WS_SYSMENU to the .rc to force the icon to appear, but, until the property sheet loads the icon I want, I see the MFC cube icon in the taskbar button. After the property sheet loads the icon, that one is always displayed on the taskbar, even when I've temporarily destroyed the property sheet and the modeless dialog has reappeared.
What I'd like is to be able to hide the modeless dialog when I display the property sheet and not have the taskbar button disappear, and to set the taskbar button's icon so the MFC cube doesn't appear.
|
|
|
|
|
i just tried following code it works
m_prop.m_hIcon = AfxGetApp()->LoadIcon(IDI_MYICON);
m_prop.m_psh.dwFlags |= PSP_USEHICON;
m_prop.m_psh.hIcon = m_prop.m_hIcon;
SetIcon(m_hIcon, TRUE);
try this may help you...
The secret of life is not enjoyment
but education through experience.
- Swami Vivekananda.
|
|
|
|
|
The problem I have is in the table.
When I create a table of 12 lines the data printed is correct.
Then I come back in beause the is two tables. The second table has 6 rows.
Howver I only process only 5 roww. I move in data for these 5 rows and the when printed. The 6 row hase the data from the frist pages data for the 6th row. I do space out the data however, the data still has the data from the first page for the 6 row.
Can you PLEASE help me. My email address is WillmsDick@hotmain.com
Thanks
|
|
|
|
|
|
Post what you have tried (please use code tags), and maybe rephrase your original post as it was very unclear (to me anyways) as to what you are saying.
|
|
|
|
|
You should delete the data in your first table (12 rows) before adding the new data from the second table. When all you do is overwrite the old data you can get remnants of the old data mixed in with the new.
If this did not help you then you should post some relevant code to give us a better idea of what is happening.
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
Hi
I need to do some data encryption. I need encrypt the data using "perl" and decrypt the data using Borland C++ (ActiveX).
Any recommendations are greatly appreciated.
Thanks,
modified on Tuesday, October 6, 2009 1:59 PM
|
|
|
|
|
|
I tried that software package. It does not support Borland C++.
Thanks,
|
|
|
|
|
Hi
I have problem with retrive a list of files open by one process for example notepad.
I alredy have the list of processes (Name and PID)
conime.exe (PID: 3384)<br />
rxvt.exe (PID: 3392)<br />
sh.exe (PID: 3484)<br />
SbPFCl.exe (PID: 3888)<br />
<unknown> (PID: 4044)<br />
GoogleDesktop.exe (PID: 4080)<br />
avgnt.exe (PID: 2184)<br />
jusched.exe (PID: 1156)<br />
GoogleDesktop.exe (PID: 1860)<br />
CarboniteSetupLitePBPreInstaller.exe (PID: 2824)<br />
rxvt.exe (PID: 3692)<br />
sh.exe (PID: 2692)<br />
notepad++.exe (PID: 2036)<br />
SciTE.exe (PID: 3156)<br />
<unknown> (PID: 3680)<br />
firefox.exe (PID: 3116)<br />
cmd.exe (PID: 1868)<br />
procexp.exe (PID: 2076)<br />
<unknown> (PID: 2604)<br />
mspaint.exe (PID: 3856)<br />
<unknown> (PID: 468)<br />
sh.exe (PID: 3880)<br />
spyprocess.exe (PID: 3260)
Let´s sey that in notepad++ I have opened 2 files .
I need the list that look like:
List:
Notepad++:
file1.txt
file2.txt (active)
file3.txt
Is there any function to enumerate this files or just to get this active file name or its path?
|
|
|
|
|
slawekwwww wrote: Is there any function to enumerate this files or just to get this active file name or its path?
Although it is unsupported by Microsoft it is possible to call the NtQuerySystemInformation Function[^] and populate an array of SYSTEM_HANDLE_INFORMATION structure.
Best Wishes,
-David Delaune
|
|
|
|
|
No, it won't work.
Notepad don"t let handles opened.
(see notepad source code)
|
|
|
|
|
kilt wrote: Notepad don"t let handles opened.
I do not understand your comment. Do you care to clarify?
Best Wishes,
-David Delaune
|
|
|
|
|
I have some code here
private: System::Void TS11_Click(System::Object^ sender, System::EventArgs^ e) {
++Tsn11;
if (Tsn11 = 0) { this->TS11->Image = Image::FromFile("C:/GamePics/NOTILE.png");}
else {
if (Tsn11 = 1){ this->TS11->Image = Image::FromFile("C:/GamePics/GREEN.png");}
else {
if (Tsn11 = 2){ this->TS11->Image = Image::FromFile("C:/GamePics/GRTRE.png");}
else {
if (Tsn11 = 3){ this->TS11->Image = Image::FromFile("C:/GamePics/ROAD.png");}
else {
if (Tsn11 = 4){ this->TS11->Image = Image::FromFile("C:/GamePics/WALL.png");}
};
};
};
};
};
};
when you click on the image, it gets the next one, but it only works one time
How can I make it work every time?
|
|
|
|
|
Hi,
This is the C++/MFC forum. You should ask your question in the C# forum[^].
Best Wishes,
-David Delaune
|
|
|
|
|
You could at least have answered it.
And I am writing it in C++...
So what...
|
|
|
|
|
You are in the wrong forum. Use the Managed C++/CLI forum[^]. This forum has nothing to do with .net.
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
Fenix2 wrote: if (Tsn11 = 0)
Shouldn't that be if (Tsn11 == 0) ?
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
Hi,
Can anyone tell me how to open a multi-page TIFF file using GDI+ ?
I use GDI+ to open various image files and then draw them on a printer DC. I use the same function for all types of image files:
Image* p = Image::FromFile(strFile);
But in the case of multipage TIFF this loads only the first page.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|