|
Hi,
Yeh your are right, that is why I want to incorporate memcpy()/memmove() functions in my code, but as I have explained, I am not sure how to implement them efficiently in my tricky buffer allocations. I am working on this from 2 days now to get it working. It would be great if anyone can come up with generalized solution for my problem .
thanks,
-Pav
|
|
|
|
|
i want to open a zipfile and want to pass a string on it.is it necessary to use serialization?.CFileDialog is used to Browse and Select a file.?
lekshmi
|
|
|
|
|
|
Hi WhiteSky,
Thank u for your reply.But i just want to open a password protected zipfile and Which Will Prompt for a Passwordwhen opened.how can i code it in VC++6.0.
CFileDialog can be used for selecting a file ,but it wont a open the file?.is there any MFC used for that?
Plz Help Me!
thanks in advance
lekshmi
|
|
|
|
|
Hi lekshmipriya ,
Do you need to open dialog in your zipfile for get password ?
|
|
|
|
|
Hi
I am using DLL (dynamic loading) into another DLL.
Say the first one as (Main DLL) and the sendond one as ( SUb DLL ).
My application use the Main DLL directly also its Dynamic loading.
Now when the application closed the destroctor of the (Main DLL) call one funtion of SubDLL. And there the application crash.
The problem is not about the function. As If I am calling any function of the SubDLL from the Destructor of the MainDLL the program crashed.
Can any body please tell me the reason and solution
Regards
Anil
|
|
|
|
|
I do not know enough to answer your question, but I would look at whether the main program thread is still running when you are shutting down the DLL as the functions in the DLL are mapped to the process space and use the stack of the calling thread.
To really know what is happening I recommend that you pick up a copy of "Programming Applications for Microsoft Windows" by Jefferey Richter (absolutly the best source of information).
Good Luck!
INTP
Every thing is relative...
|
|
|
|
|
I suspect the problem is caused by trying to call FreeLibrary from the DllMain of the main DLL - Destructors for global C++ objects in a DLL are called from DllMain . Basically in a DllMain function the system holds the "loader lock" so you can't call any function that requires this lock. That's why you're only meant to do simple initialization in DllMain : Calling LoadLibrary or FreeLibrary from DllMain is definitely out of the question. As mentioned earlier this means that in a DLL you can't call LoadLibrary or FreeLibrary from the constructor or destructor of a class that has a global instance.
Steve
|
|
|
|
|
Thanx for your advice.
Though I solved my problem in other ways, I think I have to explore about DLL little more and with reference to your message I will proceed.
Regards
Anil
|
|
|
|
|
I am writing an application that includes communications over RS232 with a terminal window.
CEditWiew looks great because I need copy and paste etc. but it's wrapping is done on a whole word basiss rather than character at a time.
Is there an option that would provide character at a time wrapping rather than deriving my own class from CScrollView?
Thanks.
Elaine
The tigress is here
|
|
|
|
|
Look at the EM_SETWORKBREAKPROC message and implement your own EditWordBreakProc() function to do the custom word breaks. Just break wherever you like. It might require a bit of trickery to work out where to put the breaks. You can categorise every character as a delimiter and let the edit control work out where to put the breaks - this should do the trick.
<edit>Oops... should be EM_SETWORDBREAKPROC not EM_SETWORDBREAK </edit>
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"
-- modified at 0:25 Friday 7th April, 2006
|
|
|
|
|
|
HI
i wanna the code of TOERS OF HANOI with graplical user interface GUL
|
|
|
|
|
|
Ooh homework
You are meant to do it yourself, that's how you learn.
If you have specific problems in the course of the homework then ask.
Elaine
The tigress is here
|
|
|
|
|
|
why not declare T_UserThread() function in SocketHandling.h?
----------
best regards
|
|
|
|
|
include header files in .cpp files and use forward declaration in .h files.
-Saurabh
|
|
|
|
|
Excuse me if I am a little confused, but I did not see a reference to T_UserThread() any where in SocketHandling.h.
If you must place the actual code for T_UserThread() in the header instead of a source code file, then you should mark it as inline. If you do not then you will get a whole lot of redefinition errors, because each source code file that includes the header will have its own copy of the function.
Another solution to such problems, at least when dealing with classes, is to use forward declarations. A forward declaration is sort of like a prototype, only for classes instead of functions.
If all else fails, then move the code for T_UserThread() into a source code file and just place a prototype in the SocketHandling.h header as well as the Globals.h header. I do not recommend this solution but it will work, you just have to make sure that both prototypes are well commented so that you know there are two of them.
Good Luck!
INTP
Every thing is relative...
|
|
|
|
|
Alright... I put a prototype at the beginning of SocketHandling.h for T_UserThread(...) , then I put the function in server.cpp and Globals.h, and now I get these errors:
Globals.h(30): error C2065: 'network' : undeclared identifier<br />
Globals.h(30): error C2065: 'network' : undeclared identifier<br />
Globals.h(30): error C2228: left of '.UserThread' must have class/struct/union type<br />
type is ''unknown-type''<br />
Globals.h(30): error C2228: left of '.UserThread' must have class/struct/union type<br />
type is ''unknown-type''<br />
server.cpp(48): error C2084: function 'int T_UserThread(void *)' already has a body<br />
server.cpp(50): error C2228: left of '.UserThread' must have class/struct/union type<br />
type is ''unknown-type''<br />
server.cpp(50): error C3861: 'network': identifier not found, even with argument-dependent lookup<br />
server.cpp(60): error C2228: left of '.Start' must have class/struct/union type<br />
type is ''unknown-type''<br />
server.cpp(60): error C3861: 'network': identifier not found, even with argument-dependent lookup<br />
server.cpp(75): error C2228: left of '.FindConnections' must have class/struct/union type<br />
type is ''unknown-type''<br />
server.cpp(75): error C3861: 'network': identifier not found, even with argument-dependent lookup<br />
SocketHandling.cpp(194): warning C4312: 'type cast' : conversion from 'long' to 'char *' of greater size<br />
SocketHandling.cpp(199): warning C4312: 'type cast' : conversion from 'long' to 'char *' of greater size<br />
SocketHandling.h(65): error C2371: 'network' : redefinition; different basic types<br />
SocketHandling.h(65): error C2371: 'network' : redefinition; different basic types
What am I doing wrong? Thanks!
BTW: I updated the files.
Lord Kixdemp
www.SulfurMidis.com
www.SulfurSoft.tk
[ftp://][http://][hotline://]tsfc.ath.cx
|
|
|
|
|
I am not sure exactly what you did, but I did forget to mention that you should not be declaring global variables in your header files. If you need a global variable like network, then you should declare it in one of your source files and then place the same statement in the globals header file [or some other header] with the prefix "extern".
Example:
// in sorce file
MyClass network;
// in header file
extern MyClass network.
As for error C2084, that is exactly why the function should be in a source file. It sound like you still have two copies of the same function, are you sure you replaced it with a prototype in the header. Because if you did not then this is exactly the type of error message you would get.
Most of the errors you seem to be getting stem from the first error. If you solve the first error then most of them will go away.
I can not go to your code link from within this page, but I will post an example of the T_UserThread() function written as an inline template. It will not help you solve your current poblem, but it will give you something else to think about as far as design is concerned. After all I believe most of your problems are the result of design issues.
INTP
Every thing is relative...
|
|
|
|
|
Template<class playertype=""> inline
int T_UserThread(PlayerType* np)
{
network.UserThread(*np);
}
// Or better yet
Template<class playertype=""> inline
int T_UserThread(PlayerType& np)
{
network.UserThread(np);
}
Both of these versions are called just like any other function, but they are type safe. That is the compiler check generates the proper function and checks the arguments at compile time. Of course I do not know why you where using a void pointer in the first place. You seemed to know what the type being passed was and therefore passing a void made no since.
Also why bother even creating the function T_UserThread() as all it needs to do is call network.UserThread(), and since network is already a global variable you can just make the call directly and it will still be clear what you are doing in your code.
INTP
Every thing is relative...
|
|
|
|
|
i read your code.
1)try to add declare:
int T_UserThread(void * np);
before
#include "SocketHandling.h"
in Globals.h
and do somethig similar to this for other files if neccessary.
2)u must add keyword
inline
for the function in Globals.h, this is syntax requires.
A special image tool for Windows C++ programmers, don't miss it!
The world unique Software Label Maker is waiting for you and me ...
A nice hyper tool for optimizing your Microsoft html-help contents.
|
|
|
|
|
I recommend you rethink the layout of your header files. Header files should never need to include each other.
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"
|
|
|
|
|
The problems he is having do stem for poor design and a lack of understanding some of the C/C++ basics. I have seen header files that include each other, a very bad idea, but they usualy solve the problems that presents with forward declarations and the like.
INTP
Every thing is relative...
|
|
|
|