|
Hello,
I would like to know how to integrate an excel sheet in an VC++6.0 application.
Can you help me? or tell me where can i find such an information.
Thanks.
|
|
|
|
|
|
I have a bunch of printers installed and I want to choose which to print to at run time (using code only - no user interface).
I know the names of the printers (as they appear in control panel printers folder) and i know the name of the one i want to use.
So what i need is, something like a SetCurrentPrinter(strMyPrinterName) func.
Any ideas?
|
|
|
|
|
If you're using Win32 API only, pass the name of the printer as 2nd parameter to CreateDC. With MFC, you can also use CWinApp::SelectPrinter and CWinApp::CreatePrinterDC.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Thanks, i am using MFC, so i'll try SelectPrinter. I cant use the DC oriented methods since i am using a library to do all the printing legwork (i just need to select a printer in advance...)
|
|
|
|
|
Depending on what your library does, you may check the docs for SetDefaultPrinter API function. It's available only on Win2000, but documentation contains code that performs the same thing on earlier systems with GetProfileString, WriteProfileString and SendNotifyMessage.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hi all,
I'm writing ActiveX ...
I have simple question, How can i get size of my ActiveX ? (I mean RECT)
Thanks for all helps ...
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Hi all,
I wrote some functions in my header file,
I wanna create .LIB file of my header file, How can i do that ?
Thanks for all helps ...
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
I would put the declarations in a header file, and the implementations in a cpp file. Then all the files should go into a DLL project (if it's MFC it should be a MFC extions DLL project). All the classes should be exported (AFX_EXT_CLASS). The compiler will generate a .dll file and a .lib file that you can include into your project.
If you don't want to use a DLL then AFAIK you cannot make a lib file. Then just include your .h and .cpp files in the project in question.
Cheers
Steen.
"To claim that computer games influence children is rediculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
Hi Steen, Thanks for reply,
You said, "All the classes should be exported (AFX_EXT_CLASS).", I didn't understand,
Can you explain more with an example ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Hi Hadi,
if you want to use the classes in your DLL outside the DLL you have to export them. And, in the program that uses the classes you have to import them. This is how you do that:
class __declspec(dllexport) CYourClass
{
public:
int m_iSomeInt;
void SomeMethod();
....
};
void CYourClass::SomeMethod()
{
...
}
Now, put all this in a DLL project and compile it. It will produce a .dll file and a .lib file.
To use this class in another program you'd have to import it:
class __declspec(dllimport) CYourClass
{
public:
int m_iSomeInt;
void SomeMethod();
....
};
#include YourClass.h
class CSomeOtherClass : public CYourClass
{
.....
};
As you can see, the file YourClass.h contains the declaration of CYourClass in both the DLL project and in the application project. The only difference between the two YourClass.h files is the use of __declspec - to export the class you use __declspec(dllexport), to import it you use __declspec(dllimport). Since it's stupid to maintain two versions of the YourClass.h file MFC uses conditional compiles to solve it. The define AFX_EXT_CLASS is defined as __declspec(dllexport) in DLL projects (more precisely in MFC extension DLL projects where the symbol _AFXEXT is automatically defined) and as __declspec(dllimport) in MFC application projects (_AFXEXT is not defined).
So the bottom line is: Put the declaration of your extension class in a header, and put AFX_EXT_CLASS between the class keyword and the class name. Include this header in your extension dll project along with the cpp file containing the implementation of the class and compile it. Put the generated lib file in the lib path in the project settings of your application project, and include the header file (containing the declaration of the extension class) in the application project - but not the cpp file with the implemention. Then everything should work nicely!
Cheers
Steen.
"To claim that computer games influence children is rediculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
Thank you for your reply ... That was very nice,
If i defined class in LIB ...
I must first link .LIB to my project ...
Then i'll can use of class in .LIB ...
And i don't need to any otherthings ..
Is it true ???
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
You still need to include the .h file in your project. Think of it this way: To use a class you need two things: a declaration and an implementation. The declaration usually goes into the .h file, and the implementation usually goes into the .cpp file. When the compiler compiles the source code where you use your class it has to know how the class is *declared* but not how it is *implemeneted*. When all .cpp files of your project has been compiled, the linker makes sure that all the references to your class is resolved - i.e. all the pointers to your class' member variables and methods have valid values. To do this the linker needs to know the addresses of the methods, and this is dependent on the implementation. So, the linker has to know the implementation of your class. If the class is implemented in a .cpp file included in your project then the linking information is available already. However, if your class is implemented in a DLL the linker needs to get this info from somewhere - and this somewhere is your .lib file. The .lib file contains a list of all the (exported) classes and their methods, along with the relative addresses of these methods. Now the linker can do its job and all's well.
So, the compiler needs to know the declaration - you have to include the .h file. The linker needs to know the implementation - you have to put the .lib file in the lib path.
Cheers
Steen.
"To claim that computer games influence children is rediculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
Great, Great reply ...
Thanks aloooooooooot for your reply,
It is my last question about my subject:
Please think, i created DLL ...
Please explain, How can i import my DLL to my project ... and how can i use of that ?
i must define .h to my project again ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Here's the steps:
You already have a DLL that was made from a MFC extension DLL project. In this DLL you have some classes that are exported by means of the AFX_EXT_CLASS macro. These classes are declared in a number of .h files. By compiling this project you have the DLL file and the .lib file.
To use this DLL in another project you would:
a) include the header(s) declaring the exported classes in the relevant source files in your app project. This is the very same .h files you used when you compiled the DLL project.
b) put the path to the .lib file into the project settings: Project->Settings->Link tab->General category->Object/library modules
compile and enjoy
Cheers
Steen.
"To claim that computer games influence children is rediculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
Dear Steen,
Today was nice day for me ... because i got all my answers ...
Thanks
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
How can I run my application before password in win98
|
|
|
|
|
Add a value to HKLM\Software\Microsoft\windows\CurrentVersion\RunServices key. Also search MSDN for RegisterServiceProcess().
--Mike--
http://home.inreach.com/mdunn/
Ford: How would you react if I said that I'm not from Guildford after all, but from a small planet somewhere in the vicinity of Betelguese?
Arthur: I don't know. Why, do you think it's the sort of thing you're likely to say?
|
|
|
|
|
I added a value as your answer,but the pwd dialog display with my dialog at
the same time,I hope the pwd dialog display after my application end!
|
|
|
|
|
I'm trying to fix the bug in my CButtonSSL class regarding radio buttons. I'm getting there (at least it doesn't crash any more!), but I'm still having a few problems.
The Platform SDK: Windows User Interface documentation for Radio Buttons states:
When the user selects either state [checked or cleared], the radio button receives the keyboard focus. The system sends the button's parent window a WM_COMMAND message containing the BN_CLICKED notification code. The parent window doesn't acknowledge this message if it comes from an automatic radio button because the system automatically sets the check state for that style." ...
"When the user selects an automatic radio button, the system automatically sets the check state of all other buttons within the same group to be cleared."
My question is how? Where does the system handle this? If I have a group of radio buttons I can see the sending of the BM_SETCHECK and BM_GETCHECK messages to the radio buttons but when my button gets clicked there is no BM_SETCHECK message sent even though it has the BS_AUTORADIOBUTTON style set.
Derek Lakin.
Salamander Software Ltd.
|
|
|
|
|
Where does the system handle this?
Spy++ shows that it's a WM_LBUTTONUP which triggers the sequence of BM_GETCHECK and BM_SETCHECK messages.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I couldn't get a handle on where this was happening or why my buttons weren't getting BM_SETCHECK messages so I've handled it all in the OnClick event handler.
It traverses through the controls in the same group sending BM_SETCHECK to each in turn.
Does this seem like a sensible solution? It appears to work for radio groups of mixed standard and custom radio buttons and groups of all custom radio buttons.
Derek Lakin.
Salamander Software Ltd.
|
|
|
|
|
If it works, it is a sensible solution. Technically, the only difference between your code and Windows is that you're setting buttons states in response to (reflected) BN_CLICKED. With autoradiobuttons, BN_CLICKED notification is sent to parent dialog during WM_LBUTTONUP processing, after series of BM_SETCHECKs.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
|
What am I doing wrong with this code?
#include "msxml2.h"
HRESULT hr;
IXMLDOMDocument *pXMLDoc;
hr = CoInitialize(0);
if (SUCCEEDED(CoCreateInstance(CLSID_DOMDocument,
NULL,
CLSCTX_INPROC_SERVER,
IID_IXMLDOMDocument,
reinterpret_cast<void**>(&pXMLDoc))))
{
//Do some code
}
CoUninitialize();
And I get linker errors:
LNK2001: unresolved external symbol _CLSID_DOMDocument2
LNK2001: unresolved external symbol _IID_IXMLDOMDocument
Please, I need help !!!
|
|
|
|