|
Well I was able to recreate your problem. Then I was able to fix it too.
One or more of the controls in the dialog could be having help id s. Set this property(Help ID) to false. Each control in a dialog has got this property. Once you set this to false the lines that you mentioned
Jack Squirrel wrote: // Generated Help ID header file
#define APSTUDIO_HIDDEN_SYMBOLS
#include "resource.hm"
#undef APSTUDIO_HIDDEN_SYMBOLS
will not be regenerated. This should fix the errors that come up.
Help ids are located in resource.hm . Once you delete the above statement you are bound to get errors because the file is no more included and the symbols are undefined.
Nibu thomas
Software Developer
|
|
|
|
|
Nibu thomas wrote: One or more of the controls in the dialog could be having help ids.
Yep. I searched for HID* in the .rc file and didn't find anything. I thought it might be corrupted, since if a control was set to true, it's label should be appearing in the .hm file. I then went through each dialog (100+) in the resource editor, selecting all controls and ensuring the HelpID was false. One of the dialogs had it set to true for all controls, but all of the controls were unlabelled. (set to their ID numbers)
I created a new project, set the HelpID flag to true, and changed the ID to a number. (1001) Sure enough it failed to compile.
I tried changing the ID to TEST, and it wrote the help ID in the .hm as HTEST. I guess the HelpID writer doesn't like IDs starting with numbers - H1001 should be a valid label for a #define.
Montreal great Guy Lafleur, quoted by CBC on being mugged while vacationing recently in Buenos Aires: "I didn't have any time to react before I got a sucker-punch in the eye. It was like one of the players from the Bruins."
|
|
|
|
|
Hi ,
This is my first posting over here. Hope to have great answers here.
I have a (Dialogbox with a button) which I open from the Menu which is
vertical shaped and docked at the left side.
I click this button on the dialogbox and AfxMessagebox is flashed which
is at the center of the dialogbox . In that way its flashing at the
left side. I call a App's DisplayMessage function in order to show this
messagebox. I though if I display this dialog from App , it may come at
the center but that is not the case.
I want this AfxMessageBox to be flashed at the center of the frame.
I read few postings here. I used following code using SetWindowsHookEx.
Sombody before said to subclass the window of AfxMessageBox in the hook
procedure . I am not sure how to do it and after that how to reposition
the window at the center of the main framme/App. So I straightaway used
SetWindowPos but not working satisfactorily.
HHOOK hookSave;
LRESULT CALLBACK hookFunc(int nCode, WPARAM wParam, LPARAM lParam)
{
if ( HCBT_CREATEWND == nCode )
{
#define pcs (((LPCBT_CREATEWND) lParam)->lpcs)
HWND hwndSave = 0;
if( WC_DIALOG == pcs->lpszClass )
{
hwndSave = (HWND) wParam;
}
if ( hwndSave )
{
// subclass_dialog_any_which_way_you_want(hwndSave);
SetWindowPos(hwndSave,HWND_TOP, 10,50,500,300,SWP_SHOWWINDOW);
//MoveWindow(hwndSave,100,500,500,300,false);
//theApp.m_pMainWnd->SubclassWindow(hwndSave);
}
#undef pcs
}
return CallNextHookEx(hookSave, nCode, wParam, lParam);
}
void CLeeApp::DisplayMessage()
{
hookSave = SetWindowsHookEx(WH_CBT, hookFunc, NULL,
::GetCurrentThreadId());
AfxMessageBox("Just for check");
UnhookWindowsHookEx(hookSave);
}
I guess this related to making AfxMessageBox as a SubClassWindow to
MainFrame which should be subclassed in the hook function (Which I dont
know how to do in the hookfunction, means hot to get the main frame
handle) and then how to get the windproc of mainframe for afxmessagebox
and then hot to get all these things to work for Afxmessagebox to
center the mainframe
Could someone help me with some guiding code postings.
It will help me a lot.
Thank you,
Lee
|
|
|
|
|
Instead of using AfxMessageBox() , use the CWnd::MessageBox() method on the window you want the message box to be centred in, ie. If you want the message box centred on your main frame, call AfxGetMainWnd()->MessageBox(...) .
Hope this helps,
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Thanks RYan ,
It helped
Just for learning purpose.
How to achieve it with AfxMessageBox using SetWindowsHookEx
and hook procedure?
How to subclass AfxMessageBox window to main window in the hook procedure and then how to to resize it. (please refer my code).
Thanks,
lee
|
|
|
|
|
yang__lee wrote: How to achieve it with AfxMessageBox using SetWindowsHookExand hook procedure?
I wouldn't ever do it that way, so I don't know how you'd do it.
yang__lee wrote: How to subclass AfxMessageBox window to main window in the hook procedure and then how to to resize it.
Message boxes are automatically sized? Why do you need a different size?
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
In the name of code reuse, does anyone have pointers to articles that give examples of how to automate another app?
Scenario: I'm writing an app that helps me do part of my job much faster. However, I must still manually copy and paste data from an existing .NET app into mine.
Therefore, I'm looking for code examples of how to programmatically control the other app the way I would do so manually.
Ex:
1) F4, enter data, press enter
2) Copy from fields
3) etc.
Most of this I can guess, FindWindow (to locate app's main window), figure out how to send keystrokes, GetWindowText on specific windows, etc. I'm just hoping someone's already done something I can use real quick instead of blowing a few hours stumbling through it.
Tom Archer (blog)
Program Manager
MSDN Online (Windows Vista and Visual C++)
MICROSOFT
-- modified at 23:47 Monday 27th March, 2006
|
|
|
|
|
Tom Archer - MSFT wrote: Most of this I can guess, FindWindow (to locate app's main window), figure out how to send keystrokes, GetWindowText on specific windows, etc. I'm just hoping someone's already done something I can use real quick instead of blowing a few hours stumbling through it.
Is this[^] what you want?
Nibu thomas
Software Developer
|
|
|
|
|
Thanks Nibu. That gets me the SendKeys bit, but the hardest part is getting the data from other app. Generally, that's not too difficult with a standard Windows app. However, it's a .NET app so I'm not sure how to programmatically find the specific windows I need. Looking at Spy++, I can see several issues: 1) they all have the same class name, 2) what I would normally see as a listbox evidently is something else and so on.
Therefore, what I'm looking for is an example of a C++ program driving a .NET application and basically screen scraping from the .NET apps windows.
Tom Archer (blog)
Program Manager
MSDN Online (Windows Vista and Visual C++)
MICROSOFT
|
|
|
|
|
Tom Archer - MSFT wrote: However, it's a .NET app so I'm not sure how to programmatically find the specific windows I need. Looking at Spy++, I can see several issues: 1) they all have the same class name, 2) what I would normally see as a listbox evidently is something else and so on.
With a .NET Framework-based application, the window messages and classes intercepted by Spy++ don't correspond to anything useful. You want to see managed events and property values. See here for more.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Yep. I remembered this article last night. It's not 100% what I wanted in that it doesn't show how to find a particular window or what I'm capable of searching for, but it's definitely a start.
Thanks David.
Tom Archer (blog)
Program Manager
MSDN Online (Windows Vista and Visual C++)
MICROSOFT
|
|
|
|
|
Can anyone tell me what are the diiferences between Visual C++ and Managed Extensions for Visual C++, in terms of code, not architecture? I'm relatively new to VC++.
|
|
|
|
|
Are you looking for MC++ or CLI?
MC++ is the original Managed Extensions syntax for writing .NET code with C++
C++/CLI is the new syntax introduced with Visual C++ 2005
Tom Archer (blog)
Program Manager
MSDN Online (Windows Vista and Visual C++)
MICROSOFT
|
|
|
|
|
I want to write a program to capture the displaying content on entire screen, whatever it's displayed by OpenGL, DirectX, or Window GDI. I wonder it might be a hard-to-slove issue, maybe need to write a Display-Card drive, anyway, i have no idea. Please help.
|
|
|
|
|
no its possible and easy to do. check this[^] article for how to do it. Dont get confused with section about directx, using GDI will be sufficient directx is just another way to do it.
-Saurabh
|
|
|
|
|
Thank you for your replying. Yeah, before i post i've been already read this article. Actually, it's a bit out of my question, that's it's just for capturing screen contents that diaplyed by DirectX or Windows GDI, but doesn't work if displayed by OpenGL as i think and many friends suggested so. Is there any only one way to capture the screen's content whatever where they're come from? Thanks a lot!
|
|
|
|
|
So sorry that i just realized the article you suggested can solve my question for both DirectX drawing or OpenGL drawing, i guess maybe the DirectX Way of captuing captures the content directly from Displaying-Card, so great! Thank you!
|
|
|
|
|
I have a set of custom controls (for pushbutton, checkbox and radiobutton) originally written in C++ and using standard GDI. Last year I added support for UxTheme API, and everything seems to work okay.
Right now, I'm adding GDI+ support, and most things seem to work fine. The only problem is that I can't get UxTheme API and GDI+ to work together perfectly. It's *almost* right, but not quite.
The code for this looks roughly like:
hdcScrn = BeginPaint( hwnd, &ps );<br />
hdcOffscreen = CreateCompatibleDC( hdcScrn );<br />
hbmpBuffer = CreateCompatibleBitmap( hdcScrn, nWidth, nHeight );<br />
SelectObject( hdcOffscreen, hbmpBuffer );<br />
<br />
<br />
DrawThemeBackground( hTheme, hdcOffscreen, BP_PUSHBUTTON, nState, lprcClient, NULL );<br />
<br />
BitBlt( hdcScrn, 0, 0, nWidth, nHeight, hdcOffscreen, 0, 0, SRCCOPY );<br />
The new GDI+ version is pretty similar, except that I'm using Graphics* and Bitmap* objects. When I get to the part for DrawThemeBackground, I'm doing this:
hdcReal = hGrfx->GetHDC();<br />
DrawThemeBackground( hTheme, hdcReal, BP_PUSHBUTTON, nState, lprcClient, NULL );<br />
hGrfx->ReleaseHDC( hdcReal );<br />
The problem is, when I draw the offscreen buffer back to the screen, the edges of the pushbutton are too dark. It looks almost as if UxTheme call is not using alpha correctly, so the outer edges are too dark.
I'm not sure if there's a good way to post screenshots on the site, so I've posted them on my own site.
std GDI version
GDI+ version
As you can see, the dialog background is a custom texture, so I don't think I can call DrawThemeParentBackground.
Anyone hints or help on this would be greatly appreciated.
--
Warner Young
|
|
|
|
|
I am about to switch to using VC++ 2005 Standard as my main development platform, and after reading a previous blog on the new Visual Studio 2005 I know I need to...
1) Patch the STL header directly by doing the following to fix the major STL stream leak bug. This saves having to rebuild the CRT library and then shipping this with your app :
1) Open up istream in \Program Files\Microsoft Visual Studio 8\VC\Include<br />
2) Before line 29, insert the following code<br />
<br />
explicit __CLR_OR_THIS_CALL basic_istream(_Mysb *_Strbuf, bool _Isstd, bool _Noinit)<br />
: _Chcount(0)<br />
{
if (!_Noinit)<br />
_Myios::init(_Strbuf, _Isstd);<br />
}<br />
<br />
3) In the same file (istream), look for the following line:<br />
<br />
: basic_istream<_Elem, _Traits>(_Strbuf, false),<br />
<br />
and change it to:<br />
<br />
: basic_istream<_Elem, _Traits>(_Strbuf, false, true),<br />
2) Due to built-in search being slow, use a macro so searches can be performed using Google or MSDN2 from within the IDE
See the following link for more info
http://www.r2musings.com/GoogleMSDNSearchWithinVisualStudio2005.aspx
Is there anything else (tips, problems) that's worth knowing ?
|
|
|
|
|
My program(.exe) is running in Win2K or XP Service Mode.
But some users has killed my process by decending the Service T_T;
i did that some process rescued my process (by excuting) but my process is killed in safe mode.
HOW DO I DO THAT~~~!!!
please give me a answer...
|
|
|
|
|
this is how the earth rounds in windows' world
|
|
|
|
|
I have a WindowsXP memory question. I have a program with one thread and a windows messageloop that runs in mainprocessthread. I create two windows. The memory usage is about 1mb, I minimize one window, and the same memory usage. But when I minimize the second widow so all windows are minimized the memory usage goes down to 200k. I have tried to simulate this programmaticaly (minimize all windows) but I have only managed to get WindowsXP to cache away the memory when I minimize the windows manually... anyone got any info on this?
-----------------------------
I am out of scope
|
|
|
|
|
|
My script language app (in C++) can create Toolbars using either system image list icons or app image list icons. Depending on the app control script code, an app toolbar is created in a loop that adds buttons as needed, by sending a TB_ADDBUTTONS message. A little later in the code I send a TB_ADDBITMAP message. This all works fine, and has done for years.
I now want to set a custom button icon by creating a bitmap (of the appropriate size) in memory, then specify this as the button bitmap, rather than loading a Resource. It seems simple enough: in the TBADDBITMAP structure, set the hInst to NULL , and the nID to the handle of the bitmap I created. Then send TB_ADDBITMAP message as before.
I note that the TB_ADDBITMAP message returns a 2. When I add an image from a Resource image list, it returns a 1. Not sure if this is important or not. The message "Returns the index of the first new image". The result is that my toolbar does not display the image I created, instead I get the default button Icon from my script.
I've been through all the TB_ messages to see if I've missed something, and tried a lot of stuff that still won't work.
Is replacing a toolbar icon resource image with a synthesized image actually possible?
Alternatively, is it possible to draw in the toolbar button image? Various test code ideas seems to suggest not.
Stewart DIBBS
|
|
|
|
|
I had exactly the same problem last week. Though it was not when adding a bitmap it was adding text. It may be the same for you. Try creating the toolbar with an extra button, you may find that on your second call to TB_ADDBITMAP, you are actually creating a new button.
You need to create your TBBUTTONS struct, complete with text and bitmaps before calling createtoolbar/createwindow. If you are having any other problems, show me the code you are using to create the toolbar.
|
|
|
|
|