|
To format a string for an int, you could use sprintf() (or similar) with %i/%d (signed int) or
%u (unsigned int), something like:
// generic - works for unicode and non-unicode builds
int MyInt = ...;
// get string representation of MyInt
TCHAR IntString[16];
_stprintf(IntString, _T("%d"), MyInt);
// set the static control text
::SetWindowText(hwndStatic, IntString);
Mark Salsbery
Microsoft MVP - Visual C++
"Great job team! Head back to base for debriefing and cocktails."
|
|
|
|
|
Dane Grant wrote: what im trying to do is on a keystroke it +1 to an int...
"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!
i have a visual c++ prog which gives me value( dist ) which i have calculated.The value varies between 1-5.( i.e not a lot ). I want to plot this in real time. Maybe just a simple bar which changes size as this would be much more eaasier than a graph as it would need scrolling.
Any one have a code for this ??or a suggestion
Thx !
[code]
LONG FAR PASCAL
MainMessageHandler(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
HDC hDC; /* handle for the display device */
PAINTSTRUCT ps; /* holds PAINT information */
TEXTMETRIC tm; /* holds TEXT information */
static HRGN hRgn; /* Rectangle region Handles */
static int CharWidth, CharHeight;
...
...
...
y += CharHeight*2; /* Print raw data value */
sprintf (OutString,"dist = %lf ", dist);
TextOut(hDC, x, y, OutString, strlen (OutString));
}
[/code]
thanks!
|
|
|
|
|
To draw a bar you could use something like FillRect().
Can you be more specific about what part is giving you trouble?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Great job team! Head back to base for debriefing and cocktails."
|
|
|
|
|
thanks for the reply.
To be honest, i have no idea how to start the plotting. The only thing i have now is my value which has to be plotted ... The book which i have doesnt say anything about real time plotting
|
|
|
|
|
How you plot depends on what you want to see...
You showed what looks like a window procedure - Is the value being delived at regular intervals
through a window message?
The basic steps for drawing to a window are:
Create or obtain a device context (DC)
Set up the DC for drawing - select the appropriate pen/brush/font into the DC
Do the drawing
Restore the DC's original pen/brush/font
Free the DC
You can do all this in response to the WM_PAINT message.
When the value changes, invalidate the rectangle or region that you want redrawn and call
UpdateWindow() to force a WM_PAINT to be sent immediately.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Great job team! Head back to base for debriefing and cocktails."
|
|
|
|
|
thanks !
yes i am already having a bunch of cases. I get out about 10 values per second so its really current. I give out the value right now in WM_paint.
i shpuld read up on the deice context!
Thanks for the reply ..
|
|
|
|
|
Sam Rens wrote: i shpuld read up on the deice context!
Yes, definitely! Also check out the BeginPaint()/EndPaint() APIs for obtaining a DC when drawing
in response to WM_PAINT.
MArk
Mark Salsbery
Microsoft MVP - Visual C++
"Great job team! Head back to base for debriefing and cocktails."
|
|
|
|
|
i cant remember how to create dialogs like buttons
thanks
|
|
|
|
|
Dane Grant wrote: cant remember how to create dialogs like buttons
A dialog that looks like a button? What are you asking?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Great job team! Head back to base for debriefing and cocktails."
|
|
|
|
|
Mark Salsbery wrote: A dialog that looks like a button?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
im sorry my question is stupid what i mean is controls
i just need an example of adding a button
|
|
|
|
|
just noticed i mave have posted in the wrong forum to this is not in mfc obviously
|
|
|
|
|
you're in the right place.
MArk
Mark Salsbery
Microsoft MVP - Visual C++
"Great job team! Head back to base for debriefing and cocktails."
|
|
|
|
|
Dane Grant wrote: my question is stupid
No such thing IMO - misworded maybe
You can add buttons to the dialog resource or
CreateWindow()/CreateWindowEx() can be used to create buttons on an already-created dialog.
For the appropriate window class to use when creating controls, see
Windows Controls[^]
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Great job team! Head back to base for debriefing and cocktails."
|
|
|
|
|
yes my question was messed up i meant adding controls thanks for the help
|
|
|
|
|
Come on, Mark. Put your double-quote fingers up when you ask those questions:
You want to create "dialogs" that look like "buttons?"
"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
|
|
|
|
|
I DID!
Mark Salsbery
Microsoft MVP - Visual C++
"Great job team! Head back to base for debriefing and cocktails."
|
|
|
|
|
For make a dialog you can use of CreateDialog it makes a modeless dialog box.
|
|
|
|
|
error lnk2001: unresolved external symbol _IID_IMediaEventEx<br />
error lnk2001: unresolved external symbol _IID_IMediaControl<br />
error lnk2001: unresolved external symbol _CLSID_FilterGraph<br />
error lnk2001: unresolved external symbol _IID_IGraphBuilder <br />
error lnk2001: unresolved external symbol _IID_IVMRWindowlessControl <br />
error lnk2001: unresolved external symbol _IID_IVMRFilterConfig <br />
error lnk2001: unresolved external symbol _CLSID_VideoMixingRenderer <br />
error lnk2001: unresolved external symbol _IID_IBaseFilter <br />
error lnk2001: unresolved external symbol _CLSID_VideoInputDeviceCategory <br />
error lnk2001: unresolved external symbol _CLSID_SystemDeviceEnum<br />
error lnk2001: unresolved external symbol _IID_ICreateDevEnum <br />
error lnk2001: unresolved external symbol _IID_IAMStreamConfig <br />
error lnk2001: unresolved external symbol _FORMAT_VideoInfo <br />
fatal error lnk1120: 13 unresolved external symbols
but there is no such errors in VC6
|
|
|
|
|
VS is unable to locate the DirectShow library, probably Strmiids.lib
See my reply about setting up your build environment properly below
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Great job team! Head back to base for debriefing and cocktails."
|
|
|
|
|
I have a project using DShow.It works well in VC6.
But when I convert it to VC2005,some errors occur.
Especially,a error like this:
1>d:\program files\microsoft visual studio .net\vc\platformsdk\include\winnt.h(222) : error C2146: syntax error : missing ';' before identifier 'PVOID64'
I thinks there is some wrong in the configuration of the DirectX(9.0b).
Someone would tell me how to config it and correct such error?
Thanks
|
|
|
|
|
The error has been resloved.
But another error occured.
It said that could not find such external :
_CLSID_VideoInputDeviceCategory
error LNK2001: _CLSID_SystemDeviceEnum
error LNK2001: _IID_ICreateDevEnum
How to resolve it?
Thanks
|
|
|
|
|
When you install the DirectX SDK, it updates the directories in your VS2005 settings
automatically. You may need to do this manually.
The errors you show look DirectShow-related. For DirectShow, you need the platform SDK as well,
unless you're using an old DirectX SDK.
Regardless, in VS 2005, go to Tools/Options Projects and Solutions/VC++ Directories and make sure
you have valid paths to the directX and DirectShow include and library directories in the
appropriate lists. These should be added at the top so they are searched before the include/lib
directories in the VS installation.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Great job team! Head back to base for debriefing and cocktails."
|
|
|
|
|
its a linker error you need to import a lib file to your project.
|
|
|
|