|
Since your code will not even compil e successfully it is little wonder it doesn't work. You are making a static call to a non-static method (phonebook::add_new(); ), which is invalid.
Try looking at your design here, every time you call add_new() you create a new phonebook object but you do not save it anywhere. Consider the contents of a real phonebook, the book contains entries and each entry contains names and numbers. So you need a collection of some sort to hold all your entries; this could be a class or one of the STL types. Perhaps you should try this without using classes as a first attempt to get the concepts right and then convert to classes later.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Hi all,
i m using MCIWnd function to play sound file.
when i m execute the command MCIWndPlay,its increase the threads counter but not decrese the thread counter even sound is end now.
please tell me can i find sound play by MCIWndPlay is end now or how can i close this thread.
or there is any method by which thread is automatically end when sound is finish.
please help me for this.
thanks in advance.
|
|
|
|
|
You may need to use the wait flag to wait until the operation completes. I think the test and notify are alternative options, but you need to read the documentation[^] for full details.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
How can I load put a swf in resources and how to load it?
Currently I am adding swf in resouces using "Add -> Resources", what type should I choose there?
I am using put_Movie function to load swf. It's working fine with external swf but I want to put swf in resources; this function accepts BSTR as argument which is path of swf so what I will give there. I am expecting something like
put_Movie(L"res://myswf.swf/#2/#234");
|
|
|
|
|
You would probably need to use a user defined resource type (see here[^]) to add this to your application. However you will also need to find a method that accepts the memory address of your resource to play the file. Resources are accessed directly in memory by their type and id, there is no pseudo path as you describe above.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
|
Unfortunately I could not found any method that uses swf from memory. Do you know any?
|
|
|
|
|
rahul.kulshreshtha wrote: I could not found any method that uses swf from memory. Do you know any?
Unfortunately not, you need to look at the features that are available and figure out a solution based on one of those.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Hi everybody:
I am greenhand in socket programming.
I want to write a little program to receive tcp data and save them from server with multi port(almost 64 ports),the data was in deferent data rate.I read msdn and decided to use CAsyncSocket.I wrote a simple class CMySocket,and overide the OnReceive function.In the function,I want to save the received data to file.
When I used the new class,I created 64 CMySocket objects,and connect to the server ports.They connected the server well,and OnReceive function was triggered.But after some seconds,for example 10 seconds or handreds seconds,some objects' OnReceive was never triggered any longer,at last all objects were still ,no data incomed.
I have no idea why my objects didnt work continuously.My class had no more function,and only overrided the OnReceive.I wondered whether there exits some method to find the problem.
The server program is written with c++ builder,and if I use c++ builder and its socket controls,I have no problem in receiving and saving data.But I dont know why it failed in VC++ 2005.
I hope your help,thanx.
modified on Sunday, December 5, 2010 11:34 PM
|
|
|
|
|
Hi Stephen,
You have not shown any code so its practically impossible to determine what is causing you grief. All I can recommend at this point is that you learn how to use the visual studio 2005 debugger[^]. It is not as difficult as it seems. My guess is that your application is generating a socket error. You should add a breakpoint in the OnReceive, OnClose and Shutdown functions and check for failures.
I would also recommend that you learn how to use a packet sniffer such as Wireshark[^].
Thanks all I can think of for now.
Good Luck,
-David Delaune
|
|
|
|
|
Thanx for your reply!I will try it.
|
|
|
|
|
Hi,I found the reason.
In OnReceive,I used a fixed length buffer to call Receive function,But in fact,sometimes the incoming data's length is great than the buffer length.So there was some data remained in system buffer,and the app didnt get them,I think it made OnReceive not be called anymore.
Thanx everybody's advice!!
|
|
|
|
|
hello guys...im trying to compile this project but getting this linker error. I have specified all the required include and library files but still it is going into wrong places and showing me the error...here is what is says
LINK : fatal error LNK1104: cannot open file '..\..\..\wrong path\src\debug\file_name.lib
what do I do? thnx
|
|
|
|
|
If that's what it says then it must be looking in that path because of your settings. Check your paths again to make sure you have not inadvertently misplaced one of them.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
I have changed the following paths (VS 2008)........
- Project -> Properties -> C/C++ -> General -> Additional Include Directories(req inc files)
- Project -> Properties -> Linker -> General -> Additional Lib Directories(req lib files)
- Project -> Properties -> Input -> Additional Dependencies (req lib file)
- Tools -> Options -> Project n Sol -> VC++ Directories -> Include file (req incl file)
- Tools -> Options -> Project n Sol -> VC++ Directories -> Library file (req lib file)
now where am i missing something? is there any path still needed?
|
|
|
|
|
I think the above is correct, and just the LIB variables are important, Include directories have no bearing on the Linker. If you look at the log files from your build you should be able to see all the directories in the search order. Your original question suggested that you had a bad path in one of the strings so you also may need to check if one of them contains a variable that refers to your "wrong path".
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Hi there,
I have to fill CImageList with bitmaps. Each bitmap represent a flag of a country.
To do this one normally adds the bitmap files as resource, then :
CImageList allFlagsList;
CBitmap flagUSA;
flagUSA.LoadBitmap(IDFlagUSA);
allFlagsList.Add(flagUSA);
CBitmap flagFrance;
flagFrance.LoadBitmap(IDFlagFrance);
allFlagsList.Add(flagFrance);
..etc
Of course it becomes tedious to do this for all flags ( actually I already did it but want to refactor it for sake of my code!).
However I can't find a way how to load a bmp image directly into a CBitmap object.
Anyone knows ?
Thanks in advance.
Push Framework - now released !
http://www.pushframework.com
|
|
|
|
|
I'm not sure I understand your question, but if you are trying to load a bitmap from a file you can use LoadImage()[^].
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Thx for your will to help.
That's what I was relying on, but this way I needed to get all flags in the resources which was tedious.
I found this which solves my issue and maybe the one who would encontere the same situation :
http://www.codeguru.com/cpp/g-m/bitmap/article.php/c1707
Push Framework - now released !
http://www.pushframework.com
|
|
|
|
|
Hey guys,
I am trying to fetch the data from here ->
http://74.54.176.106/whois/whois.cgi?domain=127.0.0.1[^]
Though I am not receiving everything, this is all I get:
<HTML&gt;
&lt;HEAD&gt;
&lt;TITLE&gt;Global Whois : whois 127.0.0.1
Tried to google but couldn't find anything that helped me.
my code:
char buffer[4096];
char strRequest[] = "GET /whois/whois.cgi?domain=127.0.0.1 / HTTP/1.0\r\n\r\n";
send(sock, strRequest, sizeof(strRequest), 0);
int i = recv(sock, buffer, sizeof(buffer), 0);
modified on Friday, November 26, 2010 11:49 AM
|
|
|
|
|
Please try to correct the "code block" so readers can understand.
You supplied a buffer length that good enough.
However you should note that the socket :recv API does not garantee to you the receipt of all incoming data at once.
You must loop on that function untill either the peer server closes the connection (I think you will get a -1 return value from recv)
or until you know that you received what you "want" ( can only be done if you decode and interpret data at same time ).
Let me suppose that you are talking to a peer webserver, so we know that when all data is sent, the server immediately closes the connection. In that case, your code
should be like this :
char buffer[4096];
int offset = 0;
while ( true )
{
int i = recv(sock, buffer+offset, sizeof(buffer)-offset, 0);
if(i != -1){
offset += i;
else
break;
}
It is the same thing with the ::send API. You can not garantee that all passed data will be sent. In both cases the system will give you the count of what it managed to process.
Of course you can help avoid these complexities but just using an existing library.
Hope this helps.
Push Framework - now released !
http://www.pushframework.com
|
|
|
|
|
Thanks, I got where you are coming from.
Unfortunately the connection doesnt close, it just sits there.
Tried sending
char strRequest[] = "GET /whois/whois.cgi?domain=127.0.0.1 HTTP/1.0\r\nConnection: Close\r\n\r\n";
but nothing.
Can you suggest me an already existing library that isn't as huge as curlpp or boost, or generally one that is somewhat easy to handle?
I am still new to c++ as you may know.
modified on Friday, November 26, 2010 12:13 PM
|
|
|
|
|
Use Poco C++. I used it before eventhough I personaly did not touch the network library of it. (consists of 3 dlls maybe you just need the network one only).
If I remember well there was a class called HttpClient so it will automatize your task.
There are test suites as well so you can figure how things are being used and even take your decision of whether to use the library or not.
http://pocoproject.org/
Push Framework - now released !
http://www.pushframework.com
|
|
|
|
|
You need to study the rules of sockets. A recv() call will only return the amount of data that is currently available on the socket. You must continue to receive data until you get the end of the transmission (I cannot remember the last piece of an HTTP message, but I'm sure you can Google it). Don't just assume you will get the entire message in one go.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Hello people.
I have a tooltip-like system that shows up information in a popup window based on where the mouse cursor points. Works fine most of the time, but when there's a message box or other modal dialog popping up because of certain events hapening in the background, the tooltip windows just stays on the screen. I guess this is because once the parent window containing the control that has the tooltips is deactivated/disabled (because of the modal dialog), it no longer receives any mouse messages thus the "tooltip" will think that the mouse is still pointing at the given location (since there's no WM_MOUSEMOVE, no WM_MOUSELEAVE...). I used the usual mouse messages (WM_MOUSEMOVE, WM_LBUTTONDOWN...) along with TrackMouseEvent[^] to know when and what to show and hide. But i don't know how to handle the case when we no longer receive any mouse input. One way i guess would be to handle WM_ACTIVATE in the parent window and then channel the event towards the child that has the tooltips but this seems to be quite a non-portable and ugly solution. So anyone knows how to do this right?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Leela: Fry, you're wasting your life sitting in front of that TV. You need to get out and see the real world.
Fry: But this is HDTV. It's got better resolution than the real world <
|
|
|
|