|
I though ini files where long since dead ...
I put everything in the registry these days....
Regards
Ray
"Je Suis Mort De Rire"
|
|
|
|
|
|
Oh sure, make me out to be the bad guy...
YOU BASTARD!
I KEEL YOU! I KEEL YOU ALL!!!!
|
|
|
|
|
I don't use the registry unless it makes sense to do so. The more data tha's contained in the registry, the longer it takes Windows to load. COM forces registry use, so if a program uses COM, there's no reason not to contribute to the registry bloat, but for simple programs, why bother?
INI files are alive and well - long live INI files.
|
|
|
|
|
I have a CToolBar member in my MDI app, it's a docking enabled toobar. If I float it, the user can click the little "x" button and close it. what actually happens to the toolbar in this case? how can I redisplay it later?
And is there a way I can handle the message generated from clicking that "x" button, without having to derive a class from CToolBar? or is that the only way?
Thanks
|
|
|
|
|
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.
|
|
|
|