|
what actually happens to the toolbar in this case?
It's only hidden, window is not destroyed.
how can I redisplay it later?
Use CFrameWnd::ShowControlBar.
And is there a way I can handle the message generated from clicking that "x" button, without having to derive a class from CToolBar?
Not exactly. Actually, you'll have to subclass the CMiniFrameWnd window that hosts floating toolbar.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hi,
I need to simulate the pressing of ALF+SHIFT keys through code...
Any idea to solve this problem?
Thanks!
|
|
|
|
|
Use keybd_event (on all 32-bit Windows versions) or SendInput (on Win98/ME/2000/XP/NT4SP3)
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I'm hoping someone will be able to answer this question with the extra info I have at hand.
I have put my code in a try catch block like this:
try
{
IFindFilesPtr pIFind(__uuidof(FindFiles));
pIFind.CreateInstance(CLSID_FindFiles);
if (pIFind == NULL) return;
}
catch(const _com_error & err)
{
CString strError(err.ErrorMessage());
AfxMessageBox(strError);
return;
}
And it crashes, telling me the class is not registered. The ATL based project that uses this class can find and use the class, the object is registered. Could anyone suggest what I need to do so that my MFC dialog based project can find my COM object ? I am initialising COM and uninitialising it in InitINstance and ExitInstance respectively.
Thanks.
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.
|
|
|
|
|
Can you create an instance of the object using the straight COM APIs? (like CoCreateInstance) Try doing that, instead of using the stuff generated by #import.
--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
|
|
|
|
|
I took out the #import line, added includes for the _i.c and .h file and did this:
IFindFiles * pIFind = NULL;
HRESULT h = CoCreateInstance(CLSID_FindFiles,
NULL,
CLSCTX_ALL,
IID_IFindFiles,
reinterpret_cast<void**>(&pIFind));
if (FAILED(h))
{
return;
}
AfxMessageBox("Succeeded");
The message box does not come up, the pointer is still NULL.
Thanks for the help - I'm really excited about getting into this and I can't seem to get past this point.
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.
|
|
|
|
|
What's the value of the HRESULT?
Also have you called CoInitialize before you try to create an instance of your COM object. I know that is one of my usual mistakes when creating COM objects in MFC.
Michael
|
|
|
|
|
It's funny you metnio that - I nearly fell off my bike riding home when I realised I'd not started COM. But adding Coinitialise and CoUnInitialise did not fix the problem. I actually create a new ATL object in my class and copied the copde across for the method and the new object creates/works perfectly.
I have no idea why the old one worked in an ATL client and not an MFC one, but I have it all working now, thank you.
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 might be wrong - but
IFindFilesPtr pIFind(__uuidof(FindFiles));
is the same as this
IFindFilesPtr pIFind = NULL;
pIFind.CreateInstance(CLSID_FindFiles);
As the Constructor calls CreateInstance.
try using only
IFindFilesPtr pIFind(__uuidof(FindFiles));
The reason why you are getting "Class is not registered" could be down to many things make sure
1. The FindFiles dll (if it is a dll) is registered.
2. Make Sure the CoClass name is FindFiles and not anything else
|
|
|
|
|
Thanks for the reply, but I started with __uuidof et al, it crashed out the same as my current line does. Alling CreateInstance returns NULL instead of crashing.
1/ The dll is registered as code running in an ATL based app uses it successfully, and
2/ it does it using IFindFilesPtr pIFind(__uuidof(FindFiles));
If you have any other suggestions, I'd love to hear them.
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.
|
|
|
|
|
Then the DLL should be properly registred.
I would suggest you debug DllMain in the COM Dll to see where
the loading fails.
(If it gets that far that is)
/Magnus
|
|
|
|
|
Are you instantiating this Object on a Separtate Thread ?
If you are then you will need to do a ::CoInitialize(NULL) at the begining of the Thread and a ::CoUninitialize() at the end of the Thread.
Each Thread needs to load the OLE Libraries.
|
|
|
|
|
hi all,
i wrote a vb application link to excel spreadsheet.
i would like to know how i can deploy this application. i found that the app. reference to excel9.olb. i have included it in my deploy setup file. however, the app. still failed to run. the runtime error is "ActiveX can't create server".
however, it work perfect after i installed office.
could anyone help me?
regards,
Jim
|
|
|
|
|
After installing Norton Antivirus ?
then unregister officeav.dll !!!!!!!!
|
|
|
|
|
hi all,
i wrote a vb application link to excel spreadsheet.
i would like to know how i can deploy this application. i found that the app. reference to excel9.olb. i have included it in my deploy setup file. however, the app. still failed to run. the runtime error is "ActiveX can't create server".
however, it work perfect after i installed office.
could anyone help me?
regards,
Jim
|
|
|
|
|
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
|
|
|
|