|
Nolyann wrote: But how can I paste the content of the file in the binary resource editor of Visual Studio 7.1?
Thanks in advance for your hint!
Just put the data in a file, add a RCDATA type into the .rc file like:
IDR_RC_DATA1 RC_DATA DISCARDABLE "c:\\folder\\file.dat"
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
Thanks David for your answer.
But in this case the file file.dat has to be delivered with the EXE file of the application, and I would avoid that.
I use another method, until someone gives a better suggestion : since I can save the chipcard data in hex representation I declare a char array initialised with this data. But I hoped there is a quicker way using the resources...
|
|
|
|
|
Nolyann wrote: But in this case the file file.dat has to be delivered with the EXE file of the application, and I would avoid that.
Ok, see if this article helps.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
Hi David,
I read your article with interest, but I decided to keep the solution of defining an array initialised with the binary data I want to embed, which I find simpler for my goal.
Thanks for your answers again.
|
|
|
|
|
1)When I add following statements in my code =>
IMpeg2Data *pMPEG = NULL;
hr = pMPEG2Demux->QueryInterface(IID_IMpeg2Data,(void**)&pMPEG);
it is giving me error as follows =>
Linking...
aDlg.obj : error LNK2001: unresolved external symbol _IID_IMpeg2Data
Debug/a.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
Creating browse info file...
What should i do? Is there any library missing. I have added libraries "Strmiids.lib Quartz.lib Dmoguids.lib" & also i have added "#include <mpeg2data.h>" header file.
2)When i tried to add following statement =>
IMpeg2PsiParser* pMpeg2Psi;
it is giving error as =>
error C2065: 'IMpeg2PsiParser' : undeclared identifier
|
|
|
|
|
My question is quite simple but I can't solve it. I have create a socket tcp, how can I know when the socket go down due to external cause?
For example when the network is down etc....
Use members like CAsynchSocket::OnClose, isn't correct because this member is called only when my application close the socket!
...however how can i do?
Thanks to all!!
|
|
|
|
|
CAsyncSocket::OnClose() is the function that should be overridden for this purpose.
One of the error codes that could be represented with the nErrorCode parameter is WSAENETDOWN.
I suspect that there would be some kind of a timeout before a net down state is detected.
--
Roger
It's suppose to be hard, otherwise anybody could do it!
|
|
|
|
|
I have tried to use it, and for test, I unplug the utp cable and OnClose() wasn't called...Have I to set some particular option when I create the socket??
When I start the socket I only do this:
if (!m_pSocket->Create())
throw 1;
// Connect to our destination.
if (!m_pSocket->Connect(strAddress, port)){
throw 2;
|
|
|
|
|
Sorry, I misunderstood you. :->
I thought you meant that you want to detect a net down state when you're are closing the socket.
I don't think it's possible to detect a net down state using sockets if you're not operating on socket. Each operation will fail if the net is down with WSAENETDOWN.
Of course it could be detected if you use some kind of keep-alive messages that are periodically sent on the socket. The Send operation will fail in such case.
Hope this helps
--
Roger
It's suppose to be hard, otherwise anybody could do it!
|
|
|
|
|
Ok I suppose that i have to set with setsockopt the keep alive message....and after i control the nErrocode in OnSend is it correct??
however thanks a lot for the answer!!!
-- modified at 5:59 Friday 5th May, 2006
|
|
|
|
|
I try to use setSocketOpt with options SO_KEEPALIVE in socket intialization phase. I stay in OnSend and Control the nErrorCode but OnSend is never called!!
|
|
|
|
|
TCP does not offer you quick detection of all kind of connection interruptions... it was designed to survive network interruption, what you are looking for is a application specific keep-alive mechanism, connection test or timeout.
It really depends on the application what you need. E.g. for a simple file server it could be enough to close the socket when no data has been sent/received for a while. For an interactive application you may want to test the connection in regular intervalls. Fo example have first an OnClose() to detect when a socket is reported down and secondly send periodically some bytes to the remote socket.
Hope it helps. A good book to read is 'Effective TCP/IP Programming'.
/M
|
|
|
|
|
I can't provide a complete solution but something you can perhaps look into.
You could separate your drawing in two parts (in your OnDraw function): first, draw everything on a DC (member variable of your class), then copy everything to the view DC (using StretchBlt function). The first part doesn't take in account the zoom (you just draw everything on the DC), but with the StretchBlt you can enlarge or compress the image (it's done automatically if the sizes are not the same). So it is up to you to calculate the new size of the image (depending of the zoom factor).
Then, you need also to update the scroll bars sizes (using SetScrollBar) according to your zoom factor (and of course update the scroll position).
You'll have to search a little bit but I think this can achieve what you are looking for.
|
|
|
|
|
Is it not easier to use viewports ?
~RaGE();
|
|
|
|
|
No idea, I didn't knew viewports . It will be probably easier for the drawing part but I suppose you still have to manage the scrollbars.
|
|
|
|
|
Cedric,
you mean,
first draw everything on the the view in OnDraw.
then create compatible dc. (memorydc)
then build a bitmap from whatever on the view content or on Doc.
then use stretchblt to inlarge or compress the image.
Am i right?
thanks
Leya
|
|
|
|
|
No, first draw everything in the memoryDC, then stretch it to the view DC (using stretchBlt).
But take a look at Rage's solution, it will probably be easier for the drawing part (I cannot help because I never used viewports before).
|
|
|
|
|
No, first draw everything in the memoryDC, then stretch it to the view DC (using stretchBlt).
But take a look at Rage's solution, it will probably be easier for the drawing part (I cannot help because I never used viewports before).
Cedric,
then provide me the code of your solution .. memory dc, bitmap, stretchblt etc. for my purpose.
thanks
Leya
|
|
|
|
|
It was just a suggestion, I don't have any source code. You'll have to look a little bit yourself.
Did you check the solution from Rage also ?
|
|
|
|
|
Hi,
Please help me on the folowing:-
I have list view which misbehaves when i try to drag the column guides between the "column" headers to size the columns (especially the last column). By "misbehaves" I mean the list view gets rectangular patches on it (of the same colour as the main window. What am i doing wrong or which message (guess it is a notification message) am i not handling?
Thanks in advance.
|
|
|
|
|
I believe that you have taken the report view of the list control and on dragging the header control of the list the window behind the list control is showing up. If this is the case you can try as follows
Use RedrawWindow() in HDN_ITEMCHANGED
Does this solve your problem?
Vision is Always important and so is your ATTITUDE.
Wishes.
Anshuman Dandekar
|
|
|
|
|
Hi Anshuman,
Cool,
Thanks a bunch. It works like milk and water.
Neeraj.
|
|
|
|
|
Hi,
I have to create a small application in vc++ in which if I type the url of a zip file, the application lists the contents of the the zip file. Then I select one of them and only that file gets downloaded.
Is such a thing possible? i.e. an application listing the contents of a zip file on the net?
If it is so, please can you give me a general idea how to do this.
Thanks,
Tara
Fortitudine Vinsinues!
|
|
|
|
|
TheinstruTara wrote: I have to create a small application in vc++ in which if I type the url of a zip file, the application lists the contents of the the zip file. Then I select one of them and only that file gets downloaded.
AFAIK you can silently download the zip file to a temp folder, then show the contents to the user and then do the extraction stuff.
Nibu thomas
Software Developer
Faqs by Michael dunn
|
|
|
|
|
Please have a look,
char mychar[4] = {65, 97, 62, 0};
sBuf.Format("%s",mychar[0]);
There is no error after compiling the program, but there is a bug when run the program.
Thanks,
Joy Anne
|
|
|
|