|
Hi,
I have a trouble to create an Avi using DivX compression in VC++. After getting the DIBSECTION information from the 1st DIB bitmap, the AVIStreamSetFormat() generates an AVIERR_BADFORMAT return (for DivX 6.6.1 Codec).
Does anybody know why this happens and how to fix the problem?
Thanks for the help,
Stanley
|
|
|
|
|
Hey guys,
I'm using "ManualMap" (loads a DLL without calling LoadLibrary, does relocating and everything manually) for loading a DLL into a target process, but as soon as the process is running on Vista, it just crashes. I dont know, if its caused by my module itself or the loader (I dont have Vista myself, so I cant test/debug it), but since I read in "Dynamic TEXT Section Image Verification" (http://www.codeproject.com/useritems/VerifyIntegrity.asp), that base relocating is working differently on Vista, this may be the problem. So, could someone explain what is different on Vista? When I have problems implementing it, I'll ask again^^
Xero|Hawk
|
|
|
|
|
Ok... I am working on C++ in highschool, I only just recently learned it, so I am still a beginner. I need some help with something very simple.
I am makeing a program in Visual C++ 6.0, it needs to have a button that says 'Start', and when clicked it changes to 'Stop'. When clicked the first time, a timer starts, and counts until I click the button again to stop it, in wich case the buttons text changes to 'start'.
I have no idea how to change a buttons text mid program. I know how to do timers, those are easy enough, but this button escapes me. Any help you can give would be GREATLY apreaciated.
|
|
|
|
|
Do you need to SetWindowText(); ?
|
|
|
|
|
Hi,
The best way is to create a member for the button using the class wizard.
As far as I remember, In Visual studio 6.0 , you can open the class wizard with ctrl + W.
After creating the member for the button,you can use all its methods using that member.
For example:
Let say that you called your member m_MyButton.
Using that member,you can change It's caption by calling the SetWindowText(i.e m_MyButton.SetWindowText("STOP")).
Eli
|
|
|
|
|
As WhiteSky mentioned, SetWindowText() will do it. If the button is in a dialog, you can also use SetDlgItemText() .
|
|
|
|
|
Ah! Thank you all SO much! I never would have found that, seeing as I seem to have the codeing skills of a badger. Alright, I will let you know if it works.
|
|
|
|
|
And a more thing if you have a variable for your button you can use m_Button.SetWindowText(""); if you dont have you can use of GetDlgItem(IDC_BUTTON1)->SetWindowText("");
|
|
|
|
|
Alright, well, that code worked perfectly. But now I need some way to make sure the button knows when to switch. I was thinking some code like
'if (counter == 1)
{
m_Counter.SetWindowText("Stop")
counter = 2
}
if (counter == 2)
{
m_Counter.SetWindowText("Start")
counter = 1
}'
The problem with this is, this relys on me setting one as the default value immedietly, and I don't know how to do that =/
|
|
|
|
|
I've used the CreateDibSection function to create a DIB for bitmap...
HWND hWnd = this->GetSafeHwnd();<br />
HDC hdc = ::GetDC(hWnd);<br />
<br />
BITMAPINFO bmpInfo;<br />
<br />
ZeroMemory(&bmpInfo,sizeof(bmpInfo));<br />
bmpInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);<br />
bmpInfo.bmiHeader.biBitCount = 8;<br />
bmpInfo.bmiHeader.biCompression = BI_RGB;<br />
bmpInfo.bmiHeader.biSizeImage = 0;
bmpInfo.bmiHeader.biPlanes = 1;<br />
bmpInfo.bmiHeader.biHeight = 768;<br />
bmpInfo.bmiHeader.biWidth = 1024;<br />
bmpInfo.bmiHeader.biClrUsed = 256;<br />
<br />
hFrameBitmap = CreateDIBSection(hFrameDC, &bmpInfo, DIB_RGB_COLORS, &pBits, NULL, NULL);
I'm wondering how I can set the 4th parameter to point to a FILE* type which I store my raw pixel data, where pBits must be a LPVOID.
Thanks
|
|
|
|
|
Hi folks!
Did you ever use System Console Software?
If no, try it now. Very interesting approach to scalable and amazing features for every day ( www.syscon.tsoftech.com ).
|
|
|
|
|
I use codeblocks + wxdgets
and try a sample
but get the following
:: === t3, Debug ===
D:\wxWidgets-2.8.3\include\wx\platform.h:14: warning: "/*" within comment
D:\wxWidgets-2.8.3\include\wx\platform.h:14: warning: "/*" within comment
D:\wxWidgets-2.8.3\include\wx\platform.h:14: warning: "/*" within comment
D:\wxWidgets-2.8.3\include\wx\msw\dde.h:100: error: `wxDDEConnectionList' declared as an `inline' field
D:\wxWidgets-2.8.3\include\wx\msw\dde.h:100: error: expected `;' before '&' token
D:\wxWidgets-2.8.3\include\wx\msw\dde.h:105: error: expected `;' before "protected"
D:\wxWidgets-2.8.3\include\wx\msw\dde.h:108: error: `wxDDEConnectionList' does not name a type
D:\wxWidgets-2.8.3\include\wx\msw\dde.h:130: error: `wxDDEConnectionList' declared as an `inline' field
D:\wxWidgets-2.8.3\include\wx\msw\dde.h:130: error: expected `;' before '&' token
D:\wxWidgets-2.8.3\include\wx\msw\dde.h:135: error: expected `;' before "protected"
D:\wxWidgets-2.8.3\include\wx\msw\dde.h:137: error: `wxDDEConnectionList' does not name a type
D:\wxWidgets-2.8.3\samples\minimal\minimal.cpp:163: error: `menuBar' undeclared (first use this function)
D:\wxWidgets-2.8.3\samples\minimal\minimal.cpp:163: error: (Each undeclared identifier is reported only once for each function it appears in.)
:: === Build finished: 10 errors, 3 warnings ===
why?
|
|
|
|
|
cform0 wrote: why?
What exactly are you asking "why" to?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
cform0 wrote: why?
Why NOT fix the warnings and errors one by one?
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
cform0 wrote: why?
Your question is why you get these errors?
|
|
|
|
|
Hi,
So here's my problem: In certain circumstances, I want to stop my application from being closed when the "X" Windows sysmenu button in the top right corner of the application is pressed.
How can I do this? I tried catching the WM_DESTROY message and not running a PostQuitMessage(0) but this only leaves the process running; the application window is still destroyed.
Thanks in advance!
KR
|
|
|
|
|
If working with a dialog application, you can catch the command notification from the IDCANCEL button, which is what the [X] is on a normal dialog box.
I am not certain, but I think that the [X] generates a WM_SYSCOMMAND message with a SC_CLOSE notification, so you should be able to intercept WM_SYSCOMMAND .
In fact, you might be able to do the same for dialogs...
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Catching WM_SYSCOMMAND with SC_CLOSE works, thank you.
KR
|
|
|
|
|
KellyR wrote: How can I do this? I tried catching the WM_DESTROY message and not running a PostQuitMessage(0)...
Did you try to simply return 0?
KellyR wrote: ...the application window is still destroyed.
That's because the WM_DESTROY message is sent after the window has been removed from the screen. Try WM_CLOSE instead.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
... simply return nothing.
--
=====
Arman
|
|
|
|
|
I've tried that, it doesn't work; the application process continues to run but the window closes.
KR
|
|
|
|
|
CWnd::OnDestroy() is a void function...
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
James R. Twine wrote: CWnd::OnDestroy() is a void function...
Yes, but MFC was not mentioned in the OP. The WM_DESTROY message does expect a return value, however.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi all:
I have some experience using C programming, but for C++, so many libraries have been added to it.
The task I am supposed to perform is to check if a text file can be opened, which is input a command in line parameter, e.g. argv[1].
The first line of code given by my lecturer is:
ifstream in(argv[1], ios_base::binary);
I am stuck right here. Am I supposed to check the return value of ifstream? Or am I supposed to employ a member function of ifstream, but which one?
Thank you.
|
|
|
|
|
Generally, you need to learn C++ to fully understand what is happening. Anyway, the code is simple and a common way of opening a file [well, trying to open].
ifstream in(argv[1], ios_base::binary);
Here you declare and define an object whose type is ifstream. ifstream is a class responsible for file input operations. You pass the path and an optional ios::binary arguments to its constructor. Ok, to check whether the operation succeeded, you can do one of the following;
if (in)
{
}
if (in.is_open())
{
}
In the first case, the overloaded operator bpol gets invoked implicitly. In the second case, you explicitlly call a function [which returns bool].
--
=====
Arman
|
|
|
|