|
make your dialog ( and all its dependencies ) a DLL.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Thanks for the post, I have had a re-think.
As the first dialog needs to do some special processing can I create another couple of dialogs (based on the first), but with different initialisation.
i.e. can you during the MFC dialog's Init routine create another dialog
I did try but got the error:-
<code>g_pIDU[0] = this;
for(int q = 1; q < 4; q++)
{
g_pIDU[q] = new CIDU_Dlg(this);
g_pIDU[q]->Create(CIDU_Dlg::IDD, GetDesktopWindow());
g_pIDU[q]->InitNextDlg ();
g_pIDU[q]->ShowWindow(SW_SHOW);
g_pIDU[q]->SetActiveWindow();
} c:\\IDU_Dlg.cpp(734): error C2039: 'InitNextDlg' : is not a member of 'CBDialog'
Where 'InitNextDlg' is the Init for the other 3 dialogs.
|
|
|
|
|
Hi,
I have noticed a strange behaviour in my app.
I have 4 staic items:
static char* manuf[512];
static int link_man[512];
static char* comp[128];
static CDatasheet DS;
where CDatasheet is a class derived from CObject.
Filling in the manuf array, when I reach the 264th item, the app starts overwriting the memory space allocated for the DS object. So any assignment operation to that object produces an error.
Any suggestion?
Another question:
I tried to remove the DS object (commented out), but the compiler still build the app. I parsed all my files, but there are no other declaration for that object. What can it be happened?
Thanks
Dwarfpower
|
|
|
|
|
vilmer wrote:
static char* manuf[512];
vilmer wrote:
Filling in the manuf array, when I reach the 264th item, the app starts overwriting the memory space allocated for the DS object. So any assignment operation to that object produces an error.
How are you filling the array ? You know that manuf is an array of pointers, and not a string ? You have an array of 512 'strings' that are undefined (that is all adresses are invalid at the begining).
Post the code, so maybe we can help you.
|
|
|
|
|
Code is
manuf[i] = strdup("Hello");
the function provides to create a location of memory where it copies the string and writes the address of that location on the pointer manuf[i]
|
|
|
|
|
Hi all,
I have the following read/write program.
typedef struct
{
string s1;
string s2;
} Names;
int main
{
fstream fout("data.dat", ios::in | ios::out | ios::binary);
Names name;
name.s1.assign("abc");
name.s2.assign("xyz");
fout.write((char*)name, sizeof(Names));
fout.close
}
And then, I create another program to read this file
int main
{
fstream fin("data.dat", ios::in | ios::binary);
Names *name = new Names();
fin.read((char*)name, sizeof(Names));
// --> Till here, it's Ok. But if I want to access the struct. For example:
cout << name->s1.c_str() << endl;
fout.close
}
The strange thing is that, if I combine write and read file in one program, then no problem. But if I creat2 2 differenct programs, there's problems.
Can anyone help me out?
THank you in advance
|
|
|
|
|
int main
{
fstream fout("data.dat", ios::in | ios::out | ios::binary);
Names name; <--- not a pointer
name.s1.assign("abc");
name.s2.assign("xyz");
fout.write((char*)name, sizeof(Names)); <--- never thought you can cast
fout.close a structure to a pointer to
} char.
Either this works for weird reasons, or you made a mistake copying (char *)&name.
|
|
|
|
|
Recently I am writing a voice chatting program,I want to compress audio data before sending it to the other computer,could you help me?
|
|
|
|
|
When it is speech, you dont need as many bits to represent the sound. if its 16, use 8 instead, or even lower perhaps.
|
|
|
|
|
coulde you give me some details?thanks a lot
|
|
|
|
|
Usually speech doesnt need alot of bits to be audible.
If you record speech with 16 bit, try and reduce it.
|
|
|
|
|
|
Hi!
I had created an OLE Automation Server ( the out put is in the form of DLL). How can I use that dll in the Client Machines.
Thanks in Advance.
|
|
|
|
|
Hi ,
Exports the functions u want from DLL!
Regards,
Vishal
|
|
|
|
|
Thanks Vishal,
But I'm not using Pure DLL.
STDAPI DllRegisterServer(void)<br />
{<br />
<small> AFX_MANAGE_STATE(AfxGetStaticModuleState());<br />
COleObjectFactory::UpdateRegistryAll();<br />
return S_OK;</small><br />
}
The above function is automatically implemented by the MFC class wizard.( During the add new class using class wizard, I had created a class which is derived from the CCmdTarget and also I added automation support for it)
But, I can't find any default code support for Dllunregister server. How do I implement code for DllunregisterServer.
|
|
|
|
|
i am getting this message "bad dll calling convention" when i am using openprocess from my vb code.
why?
|
|
|
|
|
Probably because functions exported from your DLL were not written in VB
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hi all,
Im new to VC++, so i would like to ask how to write a data i store to a text file?
below are part of my code:
FILE *fp1;
Boolean Stats
if(Stats)
{
printf("number of my phone is %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
(PCHAR)(Phone->Data)[0],
(PCHAR)(Phone->Data)[1],
(PCHAR)(Phone->Data)[2],
/* how do i write the Data into My text file*/
fp1 = fopen("Phone.txt","w");
}
Thanx for the advance help.
thanx
|
|
|
|
|
Hi,
char str[1024];
wsprintf(str,"number of my phone is %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
(PCHAR)(Phone->Data)[0],
(PCHAR)(Phone->Data)[1],
(PCHAR)(Phone->Data)[2],.....);
fp1 = fopen("Phone.txt","w");
fwrite(str,...,fp);
is this you wanted ?
Regards,
Vishal
|
|
|
|
|
yes... Something like that....
fwrite(str,(PCHAR)(Phone->Data)[0],,fp);
there are some syntax problem...
thanx
|
|
|
|
|
Hi,
see the following example whhich writes 25 chars to (FILE*)stream
/* Write 25 characters to stream */
char list[25] = "a...z"
numwritten = fwrite(list, sizeof( char ), 25, stream );
in your case it should be
fwrite(str,sizeof(char),strlen(str),fp);
For more info. plz refer to MSDN documentation of fwrite, wsprintf etc.
Enjoy !
Regards,
Vishal
|
|
|
|
|
Hi,
Try this:
FILE *fp1;
char output[1024];
sprintf(output,"the number of my phone is %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
(PCHAR)(Phone->Data)[0],(PCHAR)(Phone->Data)[1],
(PCHAR)(Phone->Data)[2],.....);
fputs(output,fp1);
Eli.
|
|
|
|
|
dex_ter11 wrote:
/* how do i write the Data into My text file*/
How about using fprintf() ?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
How can you do this for other browsers like Netscape or Opera? Can this be done for other browsers?
http://www.codeproject.com/useritems/iemozilla.asp[^]
If it has been done can you tell where I can learn more about this or other good resource sites like the link above.
Thanks,
|
|
|
|
|
Hi,
I wrote the proxy app (WinSock) forwarding data from one socket to another. I listen for the client connection on the first socket, when the connection is established I create second socket and connect to the destination. Than I only forwarding data using these 2 sockets (client & destination).
My question: is it possible (after accept client connection) to bind client & destination sides without creating 2 sockets ? I mean, how to reroute connection only, without using my proxy to forward the data.
Thanks
------------------
PeterP
|
|
|
|