|
siddharthsan wrote: If i simply give like this, it's showing error as "cannot convert parameter 1 from const char to LPCWSTR",so i typecasted it as,
LoadLibrary(_T("library.dll"))
or
LoadLibrary((LPCWSTR)"library.dll"))
So the compiler is wrong and and you are making it listen by casting, right!!
|
|
|
|
|
Siddharth,
Have you tried using LoadLibraryA("library.dll") ? Your project is clearly set to use UNICODE by default and the API headers are defining LoadLibrary as LoadLibraryW. This is a bit of a strange one, I've never been quite sure what happens if you try to load a dll with the name in UNICODE (wide characters).
Note: ((LPCWSTR)"library.dll") will never work as this just casts the pointer to narrow string to a pointer to wide string but doesn't change the string
If LoadLibraryA does not work then I guess it just can't find your dll. Is it in the normal search path, i.e. same dir as exe or Windows\System32 or somewhere mentioned in the PATH environemnt variable?
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
siddharthsan wrote: LoadLibrary((LPCWSTR)"library.dll"))
if i give like this it is not taking or recognizing the library gives error as No such lib found.
Try a fully-qualified path.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
siddharthsan wrote: LoadLibrary((LPCWSTR)"library.dll"))
This is wrong. If you get into the habbit of using static_cast instead of C-style casts this kind of mistake will produce compiler errors instead of runtime errors.
Steve
|
|
|
|
|
Hi
I am making an application in VC++ 6.0 using Modal Dialog based
Problem is that when i press enter key or Press Esc Key form is closed.
Please any one told me How I avoid It.
2:
The Another Issue is In my application Backend is MySQL so
my requirment is upload .doc file in to database how can i
do it Please told me if possible with an example
Thanking You
Regard's
Kaushik
|
|
|
|
|
Y_Kaushik wrote: Please any one told me How I avoid It.
Use PreTranslateMessage()
Y_Kaushik wrote: The Another Issue is In my application Backend is MySQL so
my requirment is upload .doc file in to database how can i
do it Please told me if possible with an example
You should write some code to read from .doc file and then write the strings read into the database.
Then, Post a specific problem that you are stuck on and some one here will help you out.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Overriding PreTranslateMessage() is not the best way to do it. Read reply by Roger Stoltz, below.
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
yeah. got to read that point, didn't know about this earlier
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Yeah. Didn't know about that fact earlier.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
See this[^] thread is helpfuls?
|
|
|
|
|
Y_Kaushik wrote: Problem is that when i press enter key or Press Esc Key form is closed.
Please any one told me How I avoid It.
Read this article[^] and look no further.
Why PreTranslateMessage() should be avoided can also be read in the article.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Handle OnCancel() if you dont want to close dialog and Comment CDialog::OnCancel because Enter and Esc cause OnCommand with ID as IDCANCEL.
|
|
|
|
|
Y_Kaushik wrote: Problem is that when i press enter key or Press Esc Key form is closed.
Please any one told me How I avoid It.
See here.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi,
I have a very strange problem concerning the sockets I use in my applications.
I have written a Server application which accepts client connections. Therefore I have created a listen socket. In the OnAccept event of that listen socket I accept the incoming connection by creating a new socket and calling its accept member. Nothing strange here and everything works well.
I'm also using ado to connect to a SQL database to write log-ins and the like. But in a single customer case the SQL server is placed on a different PC. This normally doesn't give me much trouble, but sometimes under heavy network load the database-connection to this PC is lost. In that case I close the connection and create a new one. To simulate this I have setup a test PC with SQL on and I remove this PC from the network, not my development PC. After the reconnect the PC, the connection is restored and the database can be used again
But now for the strange part. In some cases, 1 out of 5-6 test, I can't accept any new clients. Using the netstat command i can see that the port is still open. It even accept new incoming request (upto 5) but I never get in the OnAccept function so I can't accept new Clients. How come that even though the TPC-IP protocol of the machine sees the new incoming request I don't get notified any more.
Any help on this matter will be highly appreciated.
codito ergo sum
|
|
|
|
|
BadKarma wrote: I accept the incoming connection by creating a new socket and calling its accept member......In some cases, 1 out of 5-6 test, I can't accept any new clients
You call Accept() on the listening socket instance and provides a reference to the new socket as argument, right?
If not, that's what you should do. I don't know what happens if you do it the other way around.
A listening socket has a queue with pending connection requests. If I remember correctly the size of the queue is configurable by hacking registry values, but I think the default value is 5 and that's what puzzles me since you say that it's 1 out of 5-6 attempts that fails.
Are we dealing with multithreading issues here as well?
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Thanks for the response.
Roger Stoltz wrote: You call Accept() on the listening socket instance and provides a reference to the new socket as argument, right?
Yes, I do it like you mentioned.
CClientSocket* pNewSocket = new CClientSocket(this);
if(!pNewSocket)
{
WriteError(ecNotEnoughMemory, "cannot_create_new_socket", "AcceptNewClient");
return;
}
if(m_pListenSocket->Accept(*pNewSocket))
{
...
}
This code is called when I fall in the OnAccept from the Listen socket. The problem is that i don't fall in the function anymore. But if I check the Socket is still (with other tools) listening and even puts incoming request in the pending queue. And indeed after 5 clients trying to connect (they hang) the sixth client gets a connection refused.
Could it be that the message handling pump is 'broken'. And if so can i check for it in order to make a new listensocket?
Yes it's a multithreaded application (about 13 threads)
codito ergo sum
|
|
|
|
|
BadKarma wrote: Roger Stoltz wrote: You call Accept() on the listening socket instance and provides a reference to the new socket as argument, right?
Yes, I do it like you mentioned.
Ok. Just wanted to make sure since it could be interpreted the other way around.
BadKarma wrote: Could it be that the message handling pump is 'broken'.
What do you mean by "broken"?
Every thread that creates a socket has to be a UI-thread, i.e. it has got to have a message pump. This means you must have a CWinThread derivative where the socket is a member of the class.
If you create sockets in worker threads that don't have message pumps, Chaos and Mayhem will follow.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Roger Stoltz wrote: What do you mean by "broken"?
Every thread that creates a socket has to be a UI-thread, i.e. it has got to have a message pump. This means you must have a CWinThread derivative where the socket is a member of the class.
If you create sockets in worker threads that don't have message pumps, Chaos and Mayhem will follow.
Yep I have a CWinThread derived class CConnectionManager which creates a CListenSocket object.
CListenSocket has override the OnAccept function to accept an incoming Client. But doesn't the listen socket creates a dummy window so it can receive the message sent. Otherwise how would one make a difference between message for the thread and those for the listen socket.
I have checked and the thread message pump is still working. So maybe the Handle to identify the listen socket has gotten invalid. Is there a way to check if the listen socket can still receive mesagges.
I have another CWinthread derivative that also manages a Listen socken on another port and this keeps on working, sometimes . Sometimes all listen sockets keep on working, other times its only the Client Listen socket which fails, yet another time its the ohter listen socket which fails. And if i'm very lucky (NOT) both the listen sockets are being kidnapped by somekind of Gremlin. AArrgh !!
I'm getting crazy with this issue. I mean the network of another pc fails. Resulting in a database connection loss. But my listen socket go down
codito ergo sum
|
|
|
|
|
Hmm, at least you haven't made the most common mistakes.
More seriously though...
When I find myself in situations like yours, I try to revert to basics.
What happens if you create a mockup with only one thread...?
See if you find anything in this article[^] that might help you.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Can't recall that I have seen such a behaviour in my networking applications. I wonder if you can go single threaded (from your postings it sounds that you are using an event based socket class with multiple threads)?
/M
|
|
|
|
|
What I am thinking is NOT kid sister safe. In fact, I'm about to just throw the dang laptop right through the window...
I have an embedded VC++ 4.0 project. FWIW, evc++ is very, very close to VS6. Let's assume it is for the moment. I go into the bitmap editor to change a bitmap (you think?). I save the changes, pull back up the bitmap, no changes!!!!
Why? I have no error messages, it claims to have saved the file? What am I missing?
Charlie Gilley
Will program for food...
Whoever said children were cheaper by the dozen... lied.
Overheard in a cubicle: "A project is just a bug under development."
Seeking to rise above the intelligence of a one eared rabbit...
|
|
|
|
|
Have you tried to modify it from MSPaint??? I had some problems with a bitmap and I solved them from paint.
Another thing you can do is to open your bitmap, copy it and paste it to another bitmap resource, go to your resources folder, change name of the old bitmap, edit the new resource (the pasted one) and set the name to the old name (so you don't need to change code in your programm).
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
Hi all:
I have a dialog containing several edit boxes, the problem I'm facing is that the dialog doesn't repond to tak key, but the edit control itself can receive the key message. I've correctly set up the tab order.
|
|
|
|
|
Process IsDialogMessage API
|
|
|
|
|
Because you have controls on the forum and they get focus.
|
|
|
|