|
if I use barcode fonts in my App, I think users can not use my App because they didn't install those fonts.
any free barcode fonts for download?
A nice hyper tool for optimizing your Microsoft html-help contents.
A best image tool for Windows C++ programmers, don't miss it!.
Includeh10
|
|
|
|
|
I'm a complete beginner with C++. I'm trying to get some sample programs that use DirectX (specifically DDraw) to compile using VC++ 6, but it's making my head hurt. Is there an idiot's guide to exactly what I have to do set everything up? Or can someone help me?
So far I've:
Downloaded & installed DirectX SDK 10
Fired up VC++ 6 and:
Tools\Options\Directories - added the \SDK\Include path to the "Include files" drop down & added the \SDK\x64 and \SDK\x86 paths to the "Library files" drop down
Project\Settings\Link - added "ddraw.lib" to the "Object/Library modules"
Obviously something's wrong though, as the sample I'm trying to compile comes back with a "error C2146: syntax error : missing ';' before identifier 'lpdd'" when it gets to the first of the list of externals ("extern LPDIRECTDRAW4 lpdd; ")
I've combed the web to the best of my ability and there seems to be lots of advice on setting up Borland and DevC++ to use DirectX, but I can't find a word about Visual C - I assume I'm being stupid.
|
|
|
|
|
I believe DirectDraw isn't officially supported since DX8. That means you still can use it, but you won't find documentation for it (last is in DX7 SDK I believe). Make sure you're on WXP as AFAIK that's what DX10 needs.
Also, I believe LPDIRECTDRAW4 is surely older interface than necessary, try LPDIRECTDRAW7 or LPDIRECTDRAW6.
As for setting up VC 6.0: set up the prober include and library directories as you did. Move them both to the top of the list! Otherwise, it won't work (at least with DX8 I've been using). You also need to link some libs... like ddraw.lib and maybe dxguid.lib, depending on what parts of DX you use (look in the libs directory and use common sense).
I believe you should better use D3D to draw graphics. As for links, gamedev.net has some nice articles and good forums for this kind of stuff (in the forum FAQ for D3D, you can even find links to some page that has older SDK for download if you want DD documentation). A nice tutorial is at http://www.andypike.com/tutorials/ . If you just want to do 2D with D3D, look up Sprites in the SDK. Also, there are some nice tutorials in the SDK's help files.
Haven't touched DX since DX8/9, so if there's something new specifically to DX10, sorry
|
|
|
|
|
Thanks very much indeed - moving the includes to the top of the list did the trick. Maybe in years to come I'll understand exactly what the linker is doing, when & why....
And thanks for all the other tips. I'm only using LPDIRECTDRAW4 because I'm cutting and pasting samples from an old Andre Lamothe book (Tricks of the Windows Game Programming Gurus). I'll try updating it and thanks too for the link.
|
|
|
|
|
Could any tell me how I display a float value in a message box.
Your result is: 1234567.5678 - for example
Many Thanks
Steve
|
|
|
|
|
I think you use to convert Numeric to String
Example:
int a=123;
TCHAR Buffer[50];
itoa(a,Buffer,10);
MessageBox(Buffer);But if you use 123.23->result 123
|
|
|
|
|
WhiteSky wrote: Example:int a=123;TCHAR Buffer[50];itoa(a,Buffer,10);MessageBox(Buffer);But if you use 123.23->result 123
what about CString::Format or wsprintf command
|
|
|
|
|
|
I need to get it in to the message box.
Cheers
Steve
|
|
|
|
|
char convert[20];
double Number = 1.123;
_gcvt( Number, 4, convert);
MessageBox(convert);
|
|
|
|
|
we're not on the managed forum
|
|
|
|
|
v2.0 wrote: we're not on the managed forum
_gcvt is a native CRT function.
Regards,
Nish
|
|
|
|
|
oh, don't know why, but i think the prefixing _gc made me wrong :->
|
|
|
|
|
Steve Kelly wrote: I need to get it in to the message box.
TCHAR szString[150];
wsprintf(szString,_T("Your Result is :- %f"),dResult);
AfxMessageBox(szString);
|
|
|
|
|
Good solution.
I'd go for this type of simple, direct solution as well, but using sprintf() and MessageBox() (I still think in Ascii and C)!
|
|
|
|
|
CString szCaption;
float fResult = 14.58;
szCaption.Format("%f" , fResult);
AfxMessageBox(szCaption);
Regards,
Eli
|
|
|
|
|
Hi all,
I have a splitter window with two list views horizontally.
My aim is to drag an EXE file and drop it in the top view. I have implemented the required drag & drop operations in the top view. Everything works fine. But I need to disable drag & drop in bottom list view. If I try to drop in the bottom view, nothing should happen. How can I achieve this. Give me your hands, please.
Thanks in advance,
Sarvan AL
-- modified at 1:54 Sunday 26th March, 2006
|
|
|
|
|
|
Hi, 1st post here
I'm trying to figure out the address where the threads of a program are currently executing. This is the code of the internal loop:
<br />
CONTEXT Context;<br />
ZeroMemory(&Context,sizeof(Context));<br />
Context.ContextFlags=CONTEXT_CONTROL|CONTEXT_INTEGER;<br />
<br />
HANDLE h=OpenT(process.NtProcess->Threads[i].id);
SuspendThread(h);<br />
GetThreadContext(h,&Context);<br />
ResumeThread(h);<br />
CloseHandle(h);<br />
All the above works fine. The problem is that for all the threads I get the same Context.Eip
Anyway, do you know a simple and better way, so that my head doesn't explode?
Thanks all!
|
|
|
|
|
Hi,
I am facing a peculiar problem. I am using Visual C++ for a program which reads the serial port continously. I am using a "while" loop for this. But after starting the program I am not able to do anything with the application window (lik minimize, maximize, or stop the program). Can anybody help me in tackling this problem.
With thanks in advance.
VKA
|
|
|
|
|
You need to have a separate thread for lengthy operations. Either that or you can pump window messages in the while loop, but that's not really recommended as it's a bad design.
|
|
|
|
|
Hi hfry,
Thanks for the reply. But Can youp please tell me how to use separate thread?
On the second point do you mean show message option with YES NO click buttons or some thing else?
I am new to programming. That is why I am not getting the terminology.
Thanks
vka
|
|
|
|
|
You create threads with the C function _beginthreadex, unless you are absolutely sure you are not using any CRT functions, in which case you can use CreateThread. You then need various ways of sending information from your main thread to the worker thread and vice versa. You can use events and have the thread wait for events to be signalled, or you could have the worker thread have its own message queue and pass messages using PostThreadMessage. I find the easiest way for the thread to send messages to the main thread is to just use SendMessage. This really all boils down to your requirements. Is there any particular reason why you aren't using asynchronous i/o? Did you check out any of the articles on Code Project?
Regarding sleeping in your loop: Sleep won't help your application respond. The reason it doesn't respond is because you are performing a lengthy operation in your main thread. The main thread never gets to get the next message in the message queue to handle. If you don't know what a message loop is or what windows messages are, it's time to go find a tutorial online.
You pump messages by having a function that looks something like this (this is not the recommended method of solving your problem)
<br />
void PumpMessages()<br />
{<br />
MSG msg;<br />
while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))<br />
{<br />
TranslateMessage(&msg);<br />
DispatchMessage(&msg);<br />
}<br />
}<br />
<br />
while(1)<br />
{<br />
DoSomething();<br />
PumpMessages();<br />
}<br />
|
|
|
|
|
You should pool the serial port, but insert small pauses on your loop like:
Sleep(10)
... and only then read it continuously. If there aren't any pauses, other programs, threads and the system itself don't have the opportunity to run properly.
|
|
|
|
|
Hi God,
How does it help in exiting the application? It is not responding to the STOP button click. If I add sleep(10), will it respond?
Thanking you,
vka
|
|
|
|