|
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?
|
|
|
|
|
Can you be a bit more specific? If you are simply wanting a snapshot of the screen saved to a BMP file, see here and here for ideas.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Hi ,
Can u pls help me out with code in VC++.
I am using DirectShow filters to compress the audio I capture from Microphone.
The filter flow is as follows WaveDest->Encoder filter(Using GSM 6.10)-> Sample Grabber.
With the Sample Grabber filter I have grabbed some samples and written them into a bts file. So now I have the GSM compressed audio file in my "buff.bts" file in the form of bitstream.
Now how do I get the original file I captured from the mike to be rendered through the speaker. i.e In order to decode this Bitstream do I have to use decode filter in the playback graph but I do not know how to get the GSM 6.10 decoder filter.
Pls help me with the code
Elza
|
|
|
|
|
HI ,
I have made a procedure for sql server with visual c++ and i have test it on my computer and it is well but when i have move it to the server it could not work and it give me the following error
ODBC: Msg 0, Level 16, State 1
Cannot load the DLL sim.dll, or one of the DLLs it references. Reason: 126(The specified module could not be found.).
can any body help me
|
|
|
|
|
It seems that some dependency dll is missing - check your dll with dependency walker and you'll see what are the dlls it need.
Probably it's some msvcrt or something like that.
Hope it helps
|
|
|
|
|
Hi there,
i hope that someone can help me with this.
My application is SDI.
I wroted a class derived from CListCtrl which is created with
LVS_OWNERDRAWFIXED style.
There is a strange behaviour when i click on a different subitem on the same
selected row. It seems that it takes 800 ms till DrawItem is called.
My class implements two methods:
void OnLButtonDown(...)
{
TRACE("Start OnLButtonDown...\n");
...
CListCtrl::OnLButtonDown(nFlags, point);
TRACE("End OnLButtonDown...\n");
}
void DrawItem(...)
{
TRACE("DrawItem...\n");
...
}
When i click at different rows i see in the debug window:
Start OnLButtonDown
DrawItem
DrawItem
..
..
End OnLButtonDown
Meaning, DrawItem is called before OnLButtonDown() finishes.
However, if i click on the same row again i see in the debug window:
Start OnLButtonDown
End OnLButtonDown
DrawItem
In that case, DrawItem is called 800 ms after OnLButtonDown finishes.
Any idea?
|
|
|
|
|