|
Sorry to bother you again but I'm still tearing my hair out with this palette window problem. I've added a handler in the MainFrame class to pick up MoveWindow notifications. This works okay. It gets a pointer to the View class and calls the UpdatePalettePos function.
Inside the UpdatePalettePos function I try to use SetWindowPos to move the palette and bring it back on top of the mainframe. However, the minute I try to access anything within the palette object the application bombs. Even m_dlgPropertySheet->GetWindowRect(rPropsRect); causes a crash. Yet the exact same function is called elsewhere within the View class and works fine.
Ahhhhhhh!
Please help!?
Simon
|
|
|
|
|
Run the debugger, setting a breakpoint before the call to UpdatePalettePos. Enter this call, and see where your application crashes. Now, debug again, this time paying attention to different variables and pointers, if they point to correct locations (For example, the m_ptrPalette in CMainFrame must match with 'this' in CPaletteWnd).
After you have specified the position of the crash, take note of the error it gives you. Is it an assertion error ? An access violation ? What is the error message with the crash ? Note that you won't see these error messages unless you use the debugger.
With this information, post the error code, and a exerpt from the code flow. Post the point where you call UpdatePalettePos and the declaration of this function.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
How can I pass a function that sorts an array of test scores in ascending order?
|
|
|
|
|
std::sort does sorting. The easy version uses your test scores' operator< for determining sort order. It gets a little more complex if you want to sort by other orders.
Or do I misunderstand your question?
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
dynamicall allocate an array large enough to hold any number of test scores to user wishes to enter. the array should then be passed to a function that sort them in ascending order. I can use std:sort under namespace std; to do that. I thought a num++ or num-- or a if statement?
confused on what to do
|
|
|
|
|
iasaber wrote:
I thought a num++ or num-- or a if statement
num++/num-- do increase/decrease num. They do not change their position in the array!
To do that you need to copy one array member to a local variable, copy the one to exchange to its position and copy your local copy to the position where the other one has been.
Dynamical allocation of your array can be done by the STLs std::vector, but I think the point is you learning to handle objects
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
Have you looked at qsort() ?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
I am using common color Dialog box in console Application, but when I move that Dialog the previous image of Dialoge not erased, any suggestion please
|
|
|
|
|
In here, you need to create a Windows (or MFC) program with a view. Then bind console entry to that view. Now you can use dialogs normally.
If you created a console application that supports MFC and then tried to create a dialog inside the program, I believe it might show symptoms like that.
Paste some code on how you do it now.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
I am using OPENGL for creating console base window with in the Console Application, from that window I am opening Color Dialog, may be the window created by OPENGL causing this problem, but I am not sure, any way I am sending the code which Creates the window and does some other tasks,Take a look on it , if u know OPENGL and tell me something please.
int main ( int argc, char** argv )
{
glutInit ( &argc, argv );
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
glutInitWindowSize ( 640, 480);
glutCreateWindow ("Solar System Simulator");
glutKeyboardFunc (keyboard);
glutDisplayFunc (display);
glutMainLoop ( );
return 0;
}
|
|
|
|
|
Okay,
You see, you use the standard C/C++ entry point function 'main' to start your program. This is ok if you were creating a pure console based application. However, a Windows programs starts from 'WinMain' function, and have a bit different parameters. What is happening here is that the pure console application is not very good at working with windows. Not even with OpenGL enabled. To summarize, you have a wrong style of approach to the problem, if you don't mind me saying
The difference between a pure console program and a Windows program is that in a Windows program, the thread can start a full-flexible message pump to handle messages from the main window or it's children. In a pure console program, this message pump is much more limited.
For instructions on how to create a Windows-based console application, read Lanz Jean-Claude's article "QuickWin" located here http://www.codeproject.com/dialog/quickwin.asp?target=windows%7Cconsole%7Capplication[^]
That tutorial will show you how to move your application from the console-based version to a Windows program which has a console redirection enabled.
If you need OpenGL, you can follow the same tutorial, but instead, when creating the splitter frames, create a view which uses OpenGL. The basic idea behind this all is, that now when your program is executed, it will have a full-fledged message pump attached to it, and if you create a new window, it will work properly.
If you are not needing the redirection from the standard console (as is, the DOS prompt in old OS), you can always use the same approach, but instead of creating a frame window, just create a small window with OpenGL view inside it. This is the way most of the small-scale 3D apps (like demos or similar) are made.
The key issue beyond everything is that you use a Windows program entry point, instead of the standard console (DOS) entry point. In order to make everything quick & convenient for yourself, just grab a copy of all code files in your project at this moment, then create a new blank Win 32 Application project in Visual Studio, paste your code files and change the 'main' function to match the correct 'WinMain' call. Now you have a fresh start working under a thread which has a full-fledged message pump support. Remember to add necessary headers and libraries to the new project to use OpenGL, if needed.
To carry on from here, just create a main window with OpenGL view, then start a message pump for the thread. The rest is functionality
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Changing the color of a CDialog or a CFormView, no problem!
But how to do this on a CDialogBar?
I want to put a bitmap into my dialog bar, so the image background is the same color of my daliog bar. The problem is that if the user changes the default colors in it control panel, then the dialog bar will be created with the systems default color.
I would like to change my Dialog Bar background to a different color. This is a MDI so the Dialog Bar is been created in CMainFrame OnCreate event.
Help please!
Alfredo
|
|
|
|
|
How to change the cursor shape in console applications
I tried the fillowing code but no result
HCURSOR hc=LoadCursor(NULL,IDC_HELP);
SetCursor(hc);
|
|
|
|
|
How about SetConsoleCursorInfo() ?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
I don't know enough to give you the solution, but here are some things I would try:
1. Check that LoadCursor is returning you a valid cursor.
2. If not, try passing it a valid hInstance parameter. GetWindowLong(GetConsoleWindow(), GWL_HINSTANCE) should give it to you.
3. Use GetLastError to see why any of your functions are not working as expected.
Regards,
Alvaro
He who laughs last, thinks slowest.
|
|
|
|
|
I think I could not describe my problem, I want to know how to change the Mouse pointer shape in console application but SetConsoleCursorInfo change
the cursor shape which indicate text postion for next typing character.
In second reply getconsolewindow is not working I check its documentation but there is no header file specfied for it, and one thing more whcih u ask LoadCursor(NULL,IDC_HELP) returning a value other than NULL so its mean it is a valid cursor.
|
|
|
|
|
(1)In MDI sub-window, how can I intercept the activated news, and neglect it??
(2)In MDI windows,I want to set a sub-window as desktop in MDI windows(be placed under the other windows). now I rewrite the news handles method, if it processes to 0x086,it does not process any, and the result is making all windows' activate status abnormal, the title bar is not brighter, the menu also can't merge with the main window.
One is never too old to learn
|
|
|
|
|
Could you be a bit more specific ? What is the thing you are trying to accomplish ? I know this question sounds silly, but I, at least, have no clue about your goals.
For example:
1. News ? What news ? Are we talking about a MDI child window ? What is it that you want to intercept ? A Windows message ?
2. A sub-window as desktop in MDI windows... Eh ? Are you talking about the MDI application mainframe window (toolbars, menus), or about the Desktop(tm) window (Windows Desktop), or something else ? What is this '0x086' you are talking about ?
If you clarify these issues and perhaps post some code along, we might be able to help you much better
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
I have programmed with Win32 enough to be called an advanced user I guess, and now I wish to port my app to handhelds...what I am looking for the analogous book: Programming Windows 5th Edition by Charles Petzold for PDA's...anything that good out there?
|
|
|
|
|
I want to obtain, preferably via WMI, a list of all the installed applications on a given box. WMI has the classes win32_Product, win32_SoftwareFeature, and win32_SoftwareElement for this purpose but they ONLY cover apps installed via MSI. I waded thru lots of classes but have yet to find any in WMI that will give the complete set.
Question:
a) Does any one know of 1 or more WMI classes that will yield the complete set of installed apps, whether or not installed via MSI.
b) If not, does any one know an alternate method?
Thanks.
Jerry
|
|
|
|
|
They only list MSI packages because the MSI runtime (msiexec) keeps a database of installed products. The WMI provider simply queries this database.
Other setups all work differently. InstallShield (not their MSI package, which goes for everything else mentioned forthwith unless otherwise stated) works differenly from Wise and does seem to keep an internal database of components, those it doesn't seem to happen for packages (speaking in MSI terms here). An up-and-coming install by Nullsoft (makers of Winamp) is very basic and doesn't seem to do anything but keep a log of what was done so it can be uninstalled (sort of like a DB transaction).
The only thing these installation methods have in common is that they almost always (some Windows Update components don't because you can't uninstall them) write to the registry key HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall. You could browse through there and see what registry keys are useful and pretty consistent, like the DisplayName and UninstallString.
As far as querying these, there is - I believe - a WMI provider for the registry. It's been a while since I've played with WMI so I apoligize. If nothing else, registries can be queried remotely by someone with the appropriate permissions, which WMI (or the responsible provider) will most likely enforce anyway.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Heath,
Thanks a bunch - I figured "the registry" was going to be the answer, but wasn't sure exactly which keys would get me there - the key you pointed out looks very promising.
But I was actually hoping that WMI provided a direct abstraction for this in some class I had so far missed. You know, a direct equivalent for the above mentioned classes (product, swfeature, swelement), but only that they included everything, not just MSI installed apps. Oh well...
In any event, you are correct - there is a provider for the registry, so I can get at the key you mention using it. Looks like that is the best route.
Thanks again!
Jerry
|
|
|
|
|
That registry key IS the place that installers MUST write to if they want to appear in the Add/Remove Applications control panel applet and participate in the functionality provided for installing and uninstall applications.
There isn't an abstract way of doing this, though. Like I said, every installer uses a proprietary installation routine. When you think about it. MSI is database-driven and as a result uses databases to store package, feature, and component information. Other installers are pretty much script-based, but I can't say ALL because even using a batch file to perform an XCOPY is considered an installation routine. The point is that they're all proprietary so there's no abstract way of getting information.
The registry is the one ring that binds them together (sorry, eagerly awaiting LOTR-ROTK!).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Heath,
Understood. Thanks again!
Jerry
|
|
|
|
|
How to get information from a screen into file?
|
|
|
|
|