|
i would like to know how do one package a software. i have developed a small software but would like to know how do i package it? there a some dependent libraries like MFCxx.dll, dao350.dll, msjet35.dll etc. do i carry the dlls along with my exe and install in the target machine? or can i create a single executable linking all the dlls with my .exe file. I know i can statically link all the mfc dlls to my .exe file. But still i am left with some other dlls which i don't know how to link. please suggest wat can be done.
|
|
|
|
|
This is a little bit of black magic.
First of all, you will want a proper installset creator. InstallShield, WISE or a free one (there is one called Inno Setup, if memory serves). DLLs installed will have to be version check, and if appropriate, registered, and installset creators helps with this.
You'll have to make sure of all the DLLs used by your application. Some are system DLLs, and should not be installed. You can search for the DLL name on MSDN, for example.
Some stuff, like ODBC, has its own redistributable installation. Some installset creators (like Wise) has premade "components" installing those.
Depends.exe can be used to find out the DLLs that the application uses, not only the obvious ones, but also DLLs used by the DLLs.
This is not a trivial process, and best is to have clean machines with the supported Windows versions to try on - something that I realize is impossible for small shareware and the such.
In your case it seems like you want to install MFC and ODBC, you can also search for this on MSDN.
|
|
|
|
|
well, i have tried using installshield to create a setup program.
depends.exe gives a list of files. do i include all? some a system dlls.
also i find dependency on MSCHRT20.OCX and MSHFLXGD.OCX. is it enough that i just include these files in my installshield project? also, how do i register it? i have not found any option in installshield to install a .dll or .ocx file?
thanx
|
|
|
|
|
Anonymous wrote:
depends.exe gives a list of files. do i include all? some a system dlls.
As I gstated in my previous post, you'll have to check MSDN for this. By going to www.microsoft.com and searching for
+"MSCHRT20.OCX" +installing
as an example, I could see that the control is included with VB and VFP, so you would have to install it.
As for how to install them, you'll have to check the InstallShield documentation. For Wise, which I use, I would set the file to be automatically registered and version checked. I'm sure there is support in InstallShield for this, otherwise it would be quite useless
|
|
|
|
|
thnx. i guess i got how to do.
|
|
|
|
|
A decent installation programme is a good investment - think how many phone calls you won't have to answer
The tigress is here
|
|
|
|
|
HI~
In WinCE (pocket pc), how to set a window to scrollable in vertical and honzontal direction?
Thanks
|
|
|
|
|
Hi,
I have an SDI app that puts stuff on the view with an OnDraw() override. It updates automatically whenever there is any Document activity but I would like to trigger a screen refresh after certain non-document events, like changes in other dialogs. I don't know how to piggyback another message map on top of OnDraw without screwing it up. Can you offer any clues?
I thought this code would work but no go: "illegal call of non-static member function". It's a virtual override generated by the ClassWizard.
CDC *pDC;
pDC = pMain->GetDC();
CAppView::OnDraw( pDC );
Thanks in advance for any advice.
|
|
|
|
|
You have to have an instance of a class to call functions of it (unless it's staic, as the error message notes).
OnDraw should not be called directly even if you have a pointer to the view, however. You should invalidate it and redraw, there are several mechanisms for this. Personally, I prefer RedrawWindow .
You can either pass a pointer to the view to the different unrelated classes, which might not be a good idea structurewise, or redraw the complete main window. This can be accomplished by calling AfxGetMainWnd()->RedrawWindow();
|
|
|
|
|
Thank you very much for your fast and helpful repsonse. RedrawWindow works nicely.
|
|
|
|
|
I want to create dial-in connection as dial-up connection,
I can create dial-up connection by using RasSetEntryProperties
Can you tell me which funciton be used for dial-in creation.
Thanks a lot!
|
|
|
|
|
char [10] = 10 bytes
unsigned int= 4 bytes
char [1] = 1 byte
MAJOR = 4 bytes
10 + 4 + 1 + 4 = 19 bytes
but it outputs 24 bytes!!
typedef enum {
CS, MIS, ME, PHI
}MAJOR;
typedef struct STUDENT_t {
char name[10];
unsigned int ID;
char sex[1];
MAJOR major;
}STUDENT;
int main(void)
{
printf("%d\n", sizeof(STUDENT));
return 0;
}
-----------------------------
C++ without virtual functions is not OO. Programming with classes but without dynamic binding is called "object based", but not "object oriented".
|
|
|
|
|
I'm just stabbing this one, but the other 5 bytes are for the struct, sepearately its 19bytes but within a struct, you allow a little more room.
Discovery consist of seeing what everybody has seen and thinking what nobody has thought -- Albert Szent-Györgyi
Name the greatest of all the inventors: accident --Mark Twain
|
|
|
|
|
I think you have the Struct Member Alignment set to 4 bytes (see option under Project/Settings/c++/code generation). For the struct you have shown the total size of the
struct would then be 24 bytes.
As it says in MSDN:
The Struct Member Alignment (/Zpn) option controls how the members of a structure are packed into memory and specifies the same packing for all structures in a module. When you specify this option, each structure member after the first is stored on either the size of the member type or n-byte boundaries (where n is 1, 2, 4, 8, or 16), whichever is smaller.
|
|
|
|
|
In a word: boundary alignment. ID is an unsigned int and MAJOR, an enum, also defaults to an int datatype. Ints are 4-byte fields that are naturally aligned on four byte boundarys. Therefore the compiler places the int fields on four byte boundarys. Doubles go on an eight byte boundary.
If the struct does not have the fields ordered in descend size of datatypes, (doubles, ints, short ints and finally char/char array), then the compiler silently inserts unreachable filler alignment bytes. Doubles, ints, etc. are boundary aligned to improve register load performance. On certain types of machines fetching unaligned data can cause an execption.
You can use a #pragma to modify the default boundary alighment.
You can see the result of what the compiler has done by generating a listing that details the struct.
Offset length Field
0 10 name
10 2 unreachable filler inserted by the compiler
12 4 ID
16 1 sex
17 3 unreachable filler inserted by the compiler
20 4 major
Total length=24
Sam
|
|
|
|
|
hi Alex,
Visual C++ ( for that matter most C++ compilers ) has got some thing
called structure alignment. For the efficient access of the memory they align varibles at the DWORD boundary.
Even though name is taking only 10 bytes. The value of ID is from
byte 12 to 16 . Even though sex takes only 1 byte , Major starts only at the 20th byte. And the size will be rounded to nearest DWORD (that is 24 )
u can use a pragma to make it one byte aligned.
#pragma pack(1)
typedef struct STUDENT_t {
char name[10];
unsigned int ID;
char sex[1];
MAJOR major;
}STUDENT;
#pragma pack(4)
now the size will be 19 as u said.
Praseed Pai
www.praseedpai.com
|
|
|
|
|
Thanks guys for all your replies.
Hi Praseed,
That's interesting. Would you tell me what does the following do?
Also, why would the nearest DWORD be 24 bytes?
#pragma pack(1)
...
#pragma pack(4)
Another question is on the DWORD. Isn't DWORD a macro for an
integer type? When do we use DWORD?
Thanks
-----------------------------
C++ without virtual functions is not OO. Programming with classes but without dynamic binding is called "object based", but not "object oriented".
|
|
|
|
|
hi Alex,
DWORD is not a macro for integer type.
i feel it is a typedef
typedef unsigned long DWORD.
Win32 code is running on a 32-bit processor . So accessing memory at
DWORD ( 4 byte aligment ) will speed things up. Visual C++ is padding to the nearest DWORD boundary to maximize performance when u have declared
something like this.
STUDENT x[10];
#pragma pack(1) makes the structure aligment into 1 and it will behave the
way u expected it to be .
ideal usage should be
#pragma pack(push) //push the current settings into pragma stack
#pragam pack(1)
// Declare the student structure here
#pragma pack(pop)
Hope this helps
Praseed Pai
www.praseedpai.com
|
|
|
|
|
Hi praseed,
Thanks for your reply.
So, when do we use DWORD in C/C++? There is a lot of
DWORD value in the registry in the windows OS, but not
sure when to use it in programming.
Thanks
-----------------------------
C++ without virtual functions is not OO. Programming with classes but without dynamic binding is called "object based", but not "object oriented".
|
|
|
|
|
Hi ,
This is the defenition of DWORD in one of the microsoft's header file.
typedef unsigned long DWORD;
usigned long is only 4 bytes (32 bits ) on Intel and AMD 32 bit platform.
( ur confusion might have started from the fact that java long is 8 bytes )
if u use DWORD (win32 data types ) , ur code can be ported to 64-bit platforms without much problem ( at least that is what ms says ).
i feel , microsoft will make sure that DWORD is always 32 bits . Where as they cannot say the thing sure about c types like int , long etc. (with IA-64 or AMD-64 !)
praseed pai
www.praseedpai.com
|
|
|
|
|
By default, data items are aligned to a boundary that matches their size - not necessarily a DWORD. A short will be aligned on a two-byte boundary, a char on a one-byte boundary, and a double on an eight-boundary.
Also, the best way to use the pack pragma is to save and restore the previous alignment. This is done as follows :
#pragma pack(push, 1) // saves old packing and sets it to 1
...
#pragma pack(pop) // restores previous packing
__________________________________________
a two cent stamp short of going postal.
|
|
|
|
|
Hello,
I am having a problem with the CreateProcess method:
The following works, starting a Notepad
PROCESS_INFORMATION pi;
STARTUPINFO si;
ZeroMemory(&si, sizeof(STARTUPINFO));
si.cb = sizeof(si);
si.wShowWindow = SW_SHOW;
ZeroMemory(&pi, sizeof(pi));
CreateProcess(NULL, "Notepad.exe", NULL, NULL, FALSE,
0, NULL, NULL, &si, &pi);
but fails, if I replace the Notepad.exe with "iexplore.exe" for IE and "wordpad.exe" for WordPad. Any reason for this difference?
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|
|
One possible reason is that notepad.exe is in the windows directory.
Kuphryn
|
|
|
|
|
That may very well be the problem. The MSDN docs says "The function will not use the search path.".
--
Ich bin Joachim von Hassel, und ich bin Pilot der Bundeswehr.
Welle: Erdball - F104-G Starfighter
|
|
|
|
|
Nice information, I will look into it.
Thanks for the support.
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|