|
You're kidding right ?
First of all, this is the Visual C++ board, your question belongs on the Visual Basic board.
Secondly, you've obviously done this by using the COM objects exposed by Office, so how on earth is that going to work unless Office is installed ?
Christian
Secrets of a happy marriage #27:
Never go to bed if you are mad at each other. It's more fun to stay up and fight.
|
|
|
|
|
I am a newbie ready to integrate graphics into my C++ programs - only one problem.... HOW THE *@
I have tried downloading simple C++ "DrawBox" programs and such, looked for documentation, but have found nothing that works. I think for one I don't know how to properly import someone's zip file containing doc, H file and Cpp file for my linker to pick up, but I am lost in general.
Could someone PLEASE help me !! CRY!!!!!
All I want to do is be able to print a DOT on the screen, and from there I will array my way to cheap silly games.
If you help not only will I be your best friend, you can get my games and their source code. I used to be an awesome Commodore programmer, and plan on developing many cheesy lan/tcp style 2 player/4 player games
Mike
Ontheritz@yahoo.com
mike@mikeperalta.com
|
|
|
|
|
I assume you are programming for windows.
The first place to start is to understand windows and device contexts. In windows everyhing is drawn onto a device context. A device context represents a virtual drawing area (kind of like a canvas). If can either map to a video device, a printer device, a plotter or just a buffer in memory.
Are you using MFC? If so, drawing can be very simple. If not, its not much harder.
Assuming you are using MFC, an easy way learn is to use the App wizard to create a document/view based application and then modify the view class. Look for a function called OnDraw. In this function you will find that app-wizard generated the function something like:
void CMyView::OnDraw()
{
CPaintDC dc(this);
// TODO: add you custom code here
}
If you modify this class to read:
void CMyView::OnDraw()
{
CPaintDC dc(this);
dc.MoveTo(0,0);
dc.LineTo(15,15);
dc.FillSolidRect(20,20,50,50,RGB(0,0,128));
}
compile and build, you will see the results.
Basically the CPaintDC class (which is derived from CDC) provides a set of functions for drawing onto the canvas. When you use these functions like I have done, you can draw lines, circles, shapes, images, etc onto the screen. There is way more to this than I could ever go into, but you should look at the CDC class in MSDN.
I should also tell you that for most commercial games, DirectX or OpenGL APIs are best instead of device context based drawing.
|
|
|
|
|
This is a huge topic and you want to draw a dot on the screen?
I have code on a different computer that draws a circle on the screen. If you remind me, I will email that to you tommorrow.
This is a huge, huge topic. There are lots of articles on animating and graphics. Start reading and don't stop.
My email is brinasas@yahoo.com. If I remember, I will email that code to you. It's super simple (which is kinda what your looking for).
Sincerely,
Danielle
|
|
|
|
|
When you say Commodore, do you mean Amiga or C64 ? You must be older than me !!!
The answers already given cover it. You need to
a/ have a compiler for Windows - you're not going to get far if you're using GNU or something and you only have standard C++ to play with. I suspect this *may* be the case because I can't think of another reason why you have been unable to draw a dot on the screen using code available here and elsewhere. Windows provides a layer of abstraction so we can code to all graphics cards with the same code, and so you need to use a Windows API. For 2D graphics I recommend DirectX, and I recommend the book 'Tricks of the Windows Game Programmers' by Andre La Mothe. For 3D I recommend OpenGL, with the ubiquitous Red and Blue books.
b/ choose an API - oops, already covered it. If you're going 2D there is also GDI+, but I don't think it's much up to games, that's what DirectX is for.
Christian
Christian
Secrets of a happy marriage #27:
Never go to bed if you are mad at each other. It's more fun to stay up and fight.
|
|
|
|
|
Yeah the Commodore 64 was the one I programmed on. I was a 6 year old programmer so I doubt I'm older than most people here at 23.. Used to make stupid little horse racing/betting games, along with stupid shooting games (like a robocop type crosshair thingy with shapes that popped up), a light cycles game that worked over your modem, and a crapload of unfinished projects - including one BARELY not finished tron-style tank game for 4 players over the modem with bouncing bullets and everything. I ultimately gave up soon because I hadn't found that "blitz!" basic to machine language yet and my mind was ready to explode from all the freaking machine language.
Thank you guys so so so so much for your help.
Yeah, I am using Dev-C++ or however its written...Although I have 'access' to an expensive compiler I haven't been using it, as a tutorial took me all the way through making my own notepad yet when it was done I had learned nothing. All the confusing::functions--->laugh.atyou() stuff is a bit too much for me to handle at this point in time, but I would like to buy a few good books on specifically understanding these types of things (need 4 dummies I think).
For now I've located an openGL example in the examples folder of DevC++ so hopefully by tonight I'll have my damn dot, and be on my way to making all the stupid games I ever wanted to and posting them up for download.
That leaves a few more questions - like if I'm choosing a low-res mode, how do i click someone's monitor into that mode so it only shows my program, only bigger so it seems full screen (and how would I get my program to reside in that top-left corner). Also are there any tutorials for running TCP/IP? Is there a difference besides IP's for LAN/Internet? Can I get a sample cpp or is that &*&& going to be complicated? How about a simple program to call my home made wavs during the game? Oh and one last important one - I get the impression that if I do a simple loop that basically says, "while the player is pushing the left key, move him one left" and then redraw at the end of all the flagchecking stuff, that the second I push left my guy will go all the way to the end of the screen and die instantly. In the old commodore 64 there was a variable in memory that would constantly count off 60th's of a second so you could slow down your apps better to a human speed, and it would be constant even if you added more code later on (since it just went off the clock). Is there a way to access this type of timing on PC's?
Thanks for your help everyone.
Mike
ontheritz@yahoo.com
mike@mikeperalta.com
|
|
|
|
|
You can use PlaySound to play a wave, and it's also possible to set the screen resolution, but I forget how. You'd be better off to use DirectX, where you can use Direct Sound for sounds and Direct Play for network access.
You can use timeGettime to track time, and then use that to set incrementing of values in your OnIdle function so you get variable frame rates and the same game play speed no matter what.
Did I recommend Tricks of the Windows Game Programming Gurus by Andre La Mothe last time ? I think it covers everything you're after, and I can only recommend it again as the best single source for all the info you are after.
Christian
Secrets of a happy marriage #27:
Never go to bed if you are mad at each other. It's more fun to stay up and fight.
|
|
|
|
|
Cool yeah I will definitely get that book so I can learn to use directx and such.. timeGettime - I'm a little fuzzy on how you would use it with OnIdle, as I'm fuzzy on C++ in general. Example?
|
|
|
|
|
I have an SDI, CFormView. I made the background of this appliation a very cool picture with jagged edges. I want to remove the border so that when you execute the program, you just see the picture, rather than the picture in a CFormView. If I can remove the border, then just the picture background is visible.
I right click on the IDD_DIALOG and clicked properties, then styles and made the border none, but it still appears. Any ideas on how to remove the border completely so that the picture gives the illusion that it is the border.
Any response any one can give me will be greatly appreciated.
Sincerely,
Danielle
|
|
|
|
|
I right click on the IDD_DIALOG and clicked properties, then styles and made the border none, but it still appears.
The border belongs to frame window. You'll have to handle WM_NCPAINT in frame class if you want to paint outside the formview.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I have a file created with the struct member alignment set to 1 byte instead of the VC++ default of 8 bytes. The file consists of a series of this structure and I now wish to read the file with a program compiled with the default 8 bytes struct member alignment. In fact, most of the files are already in circulation and conversion is not a good option.
Any help?
Best regards,
Paul.
Paul Selormey, Bsc (Elect Eng), MSc (Mobile Communication) is currently Windows open source developer in Japan, and open for programming contract anywhere!
|
|
|
|
|
Is the struct definition in its own header file? If so, then in your new program you can do:
#pragma pack(push,1)
#include <struct-definition.h>
#pragma pack(pop) Actually, the best place for those #pragma pack s is in the struct definition header itself, so that you don't have to put the #pragma s in every app that might use the header, but I don't know if that's an option for you.
--Mike--
http://home.inreach.com/mdunn/
"Make sure that if you are using a blow torch that you don't set anything on fire."
-- Chris Maunder
|
|
|
|
|
Thanks so much for the information. I have followed to find more information on the #pragma pack().
Unfortunately, currently it is not working--just crashing. But I hope I will be able to solve the problem with this information-again thanks.
Best regards,
Paul.
Paul Selormey, Bsc (Elect Eng), MSc (Mobile Communication) is currently Windows open source developer in Japan, and open for programming contract anywhere!
|
|
|
|
|
Here's the general question -- is there a way for me to remove the "Resident Name Table" from a DLL?
The DLL in question is in use only by my client application -- and should not be used by others. I would like to deter someone from reverse engineering the code. A quite enterprising person could use this list of exports to find quite a bit of information about my internals...
When I build the DLL, I also generate a LIB file.
When I build the EXE, I link with the LIB file.
It would be my assumption that the LIB file actually contains the mapping of named entry points to ordinal entry points. Yet the generated DLL still contains these named entry points. I've scoured the MSDN only to find information about this by inference -- but no hard info.
Looking thru my Visual Studio directories -- I don't see a utility that would strip it -- or this utility is cleverly named to mislead me.
I think that a lot of people would benefit from this information....
Regards,
-peter
|
|
|
|
|
Export your functions by ordinal instead of by name. You'll need to use a DEF file to do this. See the help page "Export from a DLL Using .DEF Files" for more info.
--Mike--
http://home.inreach.com/mdunn/
"Make sure that if you are using a blow torch that you don't set anything on fire."
-- Chris Maunder
|
|
|
|
|
Thanks... for the info -- but I was hoping not to do it that way.
This DLL contains about 150 classes with many methods in each. Most every class is currently marked declspec(dllexport)....
Is there no way to just strip the name table?
Sounds like I need to write one -- years ago I worked for Borland -- and we had a way to do this -- but, alas, I don't work there anymore... Those days were good -- you could always get a custom version of the linker if you needed it....
Is it the case that the loader (win32) actually resolves these names at runtime -- even if I link to the LIB created when that same DLL is built?
-p
|
|
|
|
|
I think a .DEF file is the only way to do it with MSVC. Check out MFC42.DEF (in [msdevdir]\vc98\mfc\src\intel) - even MS uses a DEF file to export stuff by ordinal.
Is it the case that the loader (win32) actually resolves these names at runtime -- even if I link to the LIB created when that same DLL is built?
Yep. The import LIB goes in your EXE and lists which exports you call. (This is how Depends knows which DLLs your app uses and what functions it calls.) When the PE loader starts up your EXE, it loads all implictly referenced DLLs and checks that they have all the entry points your EXE references.
--Mike--
http://home.inreach.com/mdunn/
"Make sure that if you are using a blow torch that you don't set anything on fire."
-- Chris Maunder
|
|
|
|
|
oh well -- thanks for the info.
it kinda seems like an opportunity to write a tool -- but it really seems like a good shortcoming of MSVC. BorlandC++ did this nicely -- oh well....
-p
|
|
|
|
|
Is there a way to send lines of formatted text to the rich edit control?
|
|
|
|
|
Hi,
I'm curious about how the floating tools (colors/swatches, history, etc) in Adobe Photoshop are implemented in VC++. At first I thought toolbars, then modeless dialogs, and now I'm wondering if they're CDialogBars or even some funky type of CView? What are your thoughts?
thanks,
Jake
Also, is there a way to get rid of the fat margins on a dialog box, which might make mine look closer to Photoshops?
|
|
|
|
|
I'll bet dollars to donuts that Photoshop does not use MFC. You can change your dialog boxes properties in the dialog editor.
Christian
Secrets of a happy marriage #27:
Never go to bed if you are mad at each other. It's more fun to stay up and fight.
|
|
|
|
|
Hi all!!!
How to create multilanguge application, in which user can change a language during run-time, for example, selecting it from menu.
Thanks.
|
|
|
|
|
Hello, the codegurus around the world.;)
We can load the resource DLL file in InitInstance()
on the user selection or detection of the language OS.
I think that this is the easiest way.
However, we may need some tool to convert English resource file
to Japanese resource file, for example.
You can find some reference of the multi-language in MSDN help.
Have a nice day!
-Masaaki Onishi-
|
|
|
|
|
Thanks.
...but can you explain this more detailed, whith example.
|
|
|
|
|
Try SetThreadLocale function. Create resources in required languages one resource for one language. For example, dialog IDD_ABOUT (English) and IDD_ABOUT (Spanish). Then use SetThreadLocale to choose Your thread locale. Loading IDD_ABOUT dilaog template will load proper version. But this function is only available on NT systems, afaik.
On non-nt system You may try to dynamically change resource handle, but don't know if it work.
I use SetThreadLocale with success in FileMaster, see: www.geocities.com/TeamMukippe/
|
|
|
|
|