|
I am trying to incorporate headers from one program into another. The host program compiles fine until I add my stdafx.h which includes:
#include afxwin.h // MFC core and standard components
#include afxext.h // MFC extensions
#include afxdisp.h // MFC Automation classes
#include afxdtctl.h // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include afxcmn.h
//(syntax edited for posting)
it then generates errors such as these in which there seems to be an ambiguity between winsock.h and winsock2.h:
c:\Documents and Settings\Brenaman\Desktop\UAV Simulator\use\SourceCode\use_ios\Globals\globals_socket_ext.h(13): error C2146: syntax error : missing ';' before identifier 'socketData'
c:\Documents and Settings\Brenaman\Desktop\UAV Simulator\use\SourceCode\use_ios\Globals\typedefs.h(41): error C2501: 'gameport::capability' : missing storage-class or type specifiers
c:\Documents and Settings\Brenaman\Desktop\UAV Simulator\use\SourceCode\use_ios\Globals\globals_socket_ext.h(15): error C2501: 'recvSockAddr' : missing storage-class or type specifiers
I've tried various things:
#define _WINSOCKAPI_ in various places to disinclude winsock.h in windows.h.
Editing windows.h to include winsock2 instead of winsock.
Various #include sequences.
However, I changed the names of the winsock headers and discovered that they are not even used by the program I am trying to incorporate headers from. The host program uses Standard Microsoft Libraries while the other seems to use MFC. Could this be the problem and if so, is there a way around it?
Thank you in advance for any help.
- Chris
|
|
|
|
|
Hello,
Where are you adding your stdafx.h file? Did you overwrite the stdafx.h from the host program? What kind of application is the host program? Is a DLL or a normal GUI application?
There is a way around this problem. I typically write DLL's if the code is to be used by an other application. You can almost flawlessly integrate the code with your other app...
Hope this helps.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Thank you for your reply! I am quite a newbie taking on a project a bit over my head so here it goes:
I am adding the stdafx.h file in a .cpp file that samples the UAV state. I did not overwrite the stdafx.h in the Release folder (perhaps that's what I need to do?). The host program is a UAV simulator GUI program. The headers I'm trying to insert are for a vibrotactile vest. This will give pilots additional guidance cues.
Your DLL approach sounds like the way to go. Could you explain how you do this a little more? Thanks again.
|
|
|
|
|
Hello,
The sole purpose of the stdafx.h is to speed up compilation by precompiling the headers that you include. One simple solution might be to include the headers you need directly and do not use stdafx.h. See what that brings you.
I assume that you know what DLL's are. If you can redesign your applications, you can group the simulator API and compile that into a DLL. A search here on CP for DLL brings you, among others, the following articles:
Regular dll Tutor For Beginners[^]
DLL's are simple 1[^]
DLL's are simple 2[^]
DLL's are simple 3[^]
DLL's are simple 4[^]
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Thank you again for your reply and the refs to DLLs. Sorry for my ignorance -I didn't really know what they were. After reading about them, I've come up with a plan:
1. The host program (executable) can export the UAV status to the DLL (cyclically)
2. The DLL is run with each call to it and can then control the tactile vest (as the execuatable sends the status)?
My assumption is that, in this situation, the DLL is like a separate execuatable but yet an included piece of code, in one (thus eliminating my library conflicts and other integration problems). Does this seem right? Thanks again.
|
|
|
|
|
Hello,
I don't know if it's wise to spawn threads in a DLL. (Are you doing this?). Your library conflics are resolved if you use the DLL approach.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Thanks for your reply. I guess it would be a DLL spawning a thread which would terminate with the signal sent to the tactile vest (although the vest requires the use of a killable timer as well). Are there some serious processing issues in this?
|
|
|
|
|
Hello,
I don't know if there are serious issues since I don't know the context. If you spawn the thread often and kill it often, you might have troubles since thread creation is an expensive operation.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Hi people,
I want to use the CTreePropSheet (by Sven Wiegand). I have a group of dialog boxes, say dialog 1, dialog 2, dialog 3. These dialogs have controls in them too, there are actions to be perfrmed based on events of those controls. Sven Wiegand has beautifully explained things out there. But I still dont understand how to do what I want. Can anyone please explain me how to do this (Step by step)? Your help is highly appreciated. Thanks a lot in advance for all of you PRO's. (Actually i've been doing a lot of C++ and not anything great in MFC, I am new)
Regards and thanks,
Rajesh R. Subramanian
You have an apple and me too. We exchange those and We have an apple each.
You have an idea and me too. We exchange those and We have two ideas each.
|
|
|
|
|
I found out the answer myself.
After adding the required files to my project, I must make sure that my dialog boxes which has controls and which has to be added to the tree control should be derived from CPropetyPage instead of CDialog.. That's it.
Regards,
Rajesh R. Subramanian
You have an apple and me too. We exchange those and We have an apple each.
You have an idea and me too. We exchange those and We have two ideas each.
|
|
|
|
|
I hope I am not asking too much.
Using an image list, I want to place some images into controls. I've got an image strip of 32x32 bitmaps - 5 of them. Upon loading these images and showing them, they are getting reduced to 8bit images. They are in my resources.
Why doesn't this work?
CBitmap ImageStrip;
ImageStrip.LoadBitmap( MAKEINTRESOURCE(IDB_DESKTOP2) );
HIMAGELIST hList = ImageList_Create( 32, 32, ILC_COLOR16, 5, 5 );
ImageList_Add( hList, (HBITMAP)ImageStrip.GetSafeHandle(), (HBITMAP)NULL );
CImageList ImageList;
ImageList.Attach( hList );
m_Grid.SetImageList( &ImageList );
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc.</A>
|
|
|
|
|
or this....
CBitmap ImageStrip;
ImageStrip.LoadBitmap( MAKEINTRESOURCE(IDB_DESKTOP2) );
CImageList ImageList;
ImageList.Create( 32,32,ILC_COLOR16,5,5);
ImageList.Add(&ImageStrip,RGB(255,255,255) );
m_Grid.SetImageList( &ImageList );
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc.</A>
|
|
|
|
|
Add ILC_COLORDDB to the flags, I see weird color problems sometimes when I don't use that flag.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
Kosh reminded me of some of the prima-donna programmers I've worked with. Knew everything but when you asked them a question; never gave you a straight answer.
-- Michael P. Butler in the Lounge
|
|
|
|
|
Sir
can anybody pls help how to load a menu in one of the pane of a Splitter Window. if view is divided in (0,0)and (0,1)
and i want to load Menu into (0,0) pane. Thank u. bye
Satishvarma.E
|
|
|
|
|
|
|
Sorry, no. The last version that could was VC++ 1.52, available (but no longer supported) via a MSDN subscription.
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
|
I'm pretty sure I saw an intro to C++ book once that came with VC 1.5 on CD.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
Pinky, are you pondering what I'm pondering?
I think so Brain, but if we shaved our heads, we'd look like weasels!
|
|
|
|
|
|
Kixdemp wrote: I've seen a lot of books on thrift stores that come with CD's/floppies... I shall check their backs next time I go there! Thanks!
look Borland version 4.5 make 16 bit windows program.. you can check out borland.com for more details
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
|
Kixdemp wrote: when I get to my Win3.1 Virtual PC!
Nice Virtaul PC for win 3.1
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
|
In this class:
http://www.codeproject.com/printing/printlib.asp
I can print text on top of a bitmap. Is there any way to
print text on top of other image formats, like a tiff or
jpeg? Or are the any other demo projects that involve
printing text on top of images?
Lets say I have a bitmap of a form that consists of black
and white text. Is there a way to determine what all of
the pixels of that bitmap are and store the pixels some-
where?
Please, any response any one can give me will be greatly
appreciated.
Sincerely,
Danielle Brina (an overworked graduate student)
|
|
|
|