|
Sorry there is no GetYahooString , it is GetString !
|
|
|
|
|
Ehsan-de-Burge wrote:
Any Suggestion how to get rid of this ?
Yes, don't pass a CString to a function expecting char*.
The GetString() prototype suggests that it expects a char* for the result, i am assuming it expects the buffer to exist and does not alloc one itself.
You have initialized 'string' to "" which is at least 1 byte in size.
When you pass 'string' to GetString() it downcasts to the buffer CString is using and passes that to GetString().
If GetString() expects the buffer to exist then you haven't made it big enough, if it alloc's one ... well then what you are doing is wrong in more ways than one.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
Hi guys,
I'm handling CBN_SELCHANGE message of a CComboBox object in my app. The calling function is said to be OnCbnSelchangeMycombo(). The message has been intercepted successfully whenever an item is selected. The problem I have is that if the combo box style is set as CBS_DROPDOWN, I am not able to correctly get the text of the selected item, the resulted string is an empty string. If the stype is CBS_DROPDOWNLIST, the return text is correct.
I tried to get the text using both GetWindowText() and UpdateData() , they return the same thing. Also, I notice the return string will be correct if I select an item using arrow keys. The string is only empty when I select the item by mouse click.
Does anybody know why?
Thanks alot.
|
|
|
|
|
You should use the CBS_SELENDOK message. While CB_SELCHANGE does what you want, you get this while a mouse is selecting a item from the list, so you may get multiple selectons before an actual item is selected by the user.
If you vote me down, my score will only get lower
|
|
|
|
|
Thanks Roger,
I tried to handle CBS_SELENDOK message and the return string is still an empty string. The handler function looks like below:
void CMyDlg::OnCbnSelendokMycombo()
{
UpdateData(TRUE);
CString szMyCombo;
m_MyCombo.GetWindowText(szMyCombo);
if (v_szMyCombo.IsEmpty())
return;
}
</code>
both szMyCombo and v_szMyCombo return empty strings. v_szMyCombo is the CString value variable for the combo box. Again, if I change the combo box style to "Drop List", the return string is correct.
Any other ideas?
|
|
|
|
|
Hi!!! I would like to ask you all, if you know how to Save an Image coming from the ClipBoard to a .jpg File... thanks alot!!!
|
|
|
|
|
try to serach fo cximage library in codeproject.that will solve your problem
-----------------------------
"I Think It will Work"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
thanks for the info... but, i only wanted to retrieve the image from the ClipBoard and Save it in a .jpg File...
|
|
|
|
|
|
The image data on clipboard must be uncompressed DIB format. First try to save image in *.bmp format. Then use ICImageCompress API to compress .bmp to .jpeg
|
|
|
|
|
Hi!
I am newbie to programming in VC and really need some urgent help with executing command lines using VC.
i have a commandline encoder called encoder.exe . From MS-DOS prompt, I can execute the encoder by the following command line:
encoder hello.wav
where hello.wav is an input file to the encoder.exe and is found in the same directory as encoder. 2 files, hello.ogg and hello.phn will be generated by the encoder.
my problem is now how to execute the command line in VC? real sorry for this seemingly simply qn. i m a poor web searcher and after surfing the net for 1 whole day, i can hardly understand how i can even get started.
|
|
|
|
|
I am not sure this is what you are asking but if it is... go into the Project/Settings and set the Debug/Program Arguments to:
hello.wav
Then start the debugger.
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
i guess it will work like this..
system("encoder hello.wav");
|
|
|
|
|
Hi!
Thanks to all for the prompt replies!
system("encoder hello.wav");
the above line works and it's great! thks!
I've also tried the following and it works too
SHELLEXECUTEINFO ShExecInfo = {0};<br />
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);<br />
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;<br />
ShExecInfo.hwnd = NULL;<br />
ShExecInfo.lpVerb = NULL;<br />
ShExecInfo.lpFile = "oggenc.exe";<br />
ShExecInfo.lpParameters = "test.wav";<br />
ShExecInfo.lpDirectory = NULL;<br />
ShExecInfo.nShow = SW_HIDE;<br />
ShExecInfo.hInstApp = NULL;<br />
ShellExecuteEx(&ShExecInfo);
this might useful as the command prompt does not flash across the screen when executed
thanks again!
|
|
|
|
|
yea! but its much longer
and dont forget to close the handle..
if(ShellExecuteEx(&inf)) {
WaitForSingleObject(inf.hProcess,-1);
CloseHandle(inf.hProcess);
}
|
|
|
|
|
hey thanks so much!
i'm still pretty new to VC executing commandline and will be most thankful if anyone has any useful website or articles to share
|
|
|
|
|
hi!
i wonder if anyones knows how to execute commandline using javascript? I'm doing a website that needs to using a commandline encoder....
|
|
|
|
|
I am creating a tab dialog with several tabs.
After inserting the property sheet with 2 tabs, I tried to add some controls to Property Page 1.
If I double click on a control (say, a button) on Property Page 1, VC complains: Cannot add new member.
I thought it was because I hadn't created a class for it, so, I used Class Wizard create a CPage1::public CPropertyPage. Nothing changed !
Again, I opened Class wizard and double clicked on IDC_BUTTON1, then let VC create the new function OnButton1(). In the body of this function, I just MessageBox("Button")
However, when I ran the program, the Property Page1 showed up with the button, but when I clicked on it, nothing happened. And still, when I clicked on other controls, I received the same complains by VC: Can not add new member
Could any one tell me what's wrong with my program & give me step-by-step instructions on how to create a tab dialog ? For some reason, Googling CPropertySheet Tutorial didn't produce any good results.
Thanks so much for any help.
|
|
|
|
|
Hello everyone.
I'm trying to properly read an id3v2 tag.
I've been trying for days now to figure it out but I cant seem to get it right.
here is what i have so far:
<br />
#include <iostream><br />
#include <string><br />
#include <fstream><br />
<br />
int main(int argc, char * argv[])<br />
{<br />
if (argc != 2) {<br />
cout<<"usage: id3v2 filename.mp3\n";<br />
exit(0);<br />
}<br />
<br />
ifstream in;<br />
in.open(argv[1]);<br />
<br />
char header[10];<br />
in.read(header,10);<br />
header[10] = '\0';<br />
<br />
if(header[0] == 'I' && header[1] == 'D' && header[2] == '3'){<br />
int hSize = ((header[3] & 127) << 21) |<br />
((header[4] & 127) << 14) |<br />
((header[5] & 127) << 7) |<br />
(header[6] & 127);<br />
<br />
int versionMajor, versionMinor;<br />
versionMajor = header[3];<br />
versionMinor = header[4];<br />
<br />
bool unsynchronisation,compression,experimental,extended,footer;<br />
unsynchronisation = false;<br />
compression = false;<br />
experimental = false;<br />
extended = false;<br />
footer = false;<br />
<br />
switch(versionMajor){<br />
case 2:<br />
unsynchronisation = (bool)(header[5] & 0x80);
compression = (bool)(header[5] & 0x40);
break;<br />
<br />
case 3:<br />
unsynchronisation = (bool)(header[5] & 0x80);
extended = (bool)(header[5] & 0x40);
experimental = (bool)(header[5] & 0x20);
break;<br />
<br />
case 4:<br />
unsynchronisation = (bool)(header[5] & 0x80);
extended = (bool)(header[5] & 0x40);
experimental = (bool)(header[5] & 0x20);
footer = (bool)(header[5] & 0x10);
break;<br />
}<br />
<br />
int sizeOfFrames;<br />
sizeOfFrames = hSize - 10;
<br />
<br />
cout<<"sizeOfFrames="<<sizeOfFrames<<endl;<br />
cout<<"\n\n";<br />
<br />
while(sizeOfFrames > 0){<br />
char frameId[4];<br />
char frameData[6];<br />
int frameSize;<br />
<br />
in.read(frameId,4);
in.read(frameData,6);
<br />
frameId[4] = '\0';
frameData[6] = '\0';
<br />
frameSize = ((frameData[0] & 127) << 21) |<br />
((frameData[1] & 127) << 14) |<br />
((frameData[2] & 127) << 7) |<br />
(frameData[3] & 127);<br />
<br />
if((frameSize > 0) && (frameSize < sizeOfFrames)){<br />
<br />
char tagInfo[frameSize];<br />
in.read(tagInfo,frameSize);<br />
tagInfo[frameSize] = '\0';
<br />
cout<<"frameId="<<frameId<<"\n";<br />
cout<<"frameSize="<<frameSize<<"\n";<br />
cout<<"tagInfo=";<br />
for(int x=0;x<sizeof(tagInfo);x++)<br />
cout<<tagInfo[x];
cout<<"\n\n";<br />
<br />
}<br />
sizeOfFrames -= frameSize;<br />
}<br />
if(versionMajor == 2){<br />
;
}<br />
}<br />
system("pause");<br />
return 0;<br />
}<br />
Sometimes it will read a bunch of garbage in from the file and print out
unexpected results, and other times it reads the id3 tag just fine.
for example: i used winamp to modify the id3v2 tag of one of my mp3 files adding the year. Then i ran this code again and it produced the unexpected results. A different mp3 file already had the year in its id3v2 tag, and when i ran this code, the program read the id3 tag just fine.
I'm almost sure that the frames have to be read differently depending on which version the tag is. I'm not sure if thats the problem or how to go about doing that.
I found someone else's code from another website that i have been trying to go off of to figure this out.
you can find it here:
http://tebl.homelinux.com/projects.php
just scroll down and click on "ID3V2"
and then click on "id3v2.c"
(sorry i cant give a direct link)
I compiled and ran the code from this website, and it reads the id3 tags for mp3 files just fine!!
So this just adds to my frustration.. I have someone else's code in front of me that works, and i still cant figure this out writing it on my own.
one thing though, i want to use fstream to do this because im most comfortable with it, and i dont want to use any structures or classes.
Just trying to write it flat and easy until i can understand everything.
Could anyone help me with the problems in my code?
I cant seem to figure out what im doing wrong.
Thanks for your time.
|
|
|
|
|
ifstream in;
in.open(argv[1], ios::in | ios::binary);
That's the first thing is saw.
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
thanks, i forgot that flag. That helped a little bit. The problem is when i get the frame size sometimes it is incorrect. Or my loop is setup wrong?
This is how im determining the size of each frame of the id3 tag.
int frameSize = ((frameData[0] & 127) << 21) |
((frameData[1] & 127) << 14) |
((frameData[2] & 127) << 7) |
(frameData[3] & 127);
I got this code from another program and dont really understand it very much.
like ((frameData[0] & 127) why 127? and then followed by << 21 why 21?
how were these numbers were pulled out of the hat?
is this correct in determining the frame size?
|
|
|
|
|
Hi Dears,
I read application that use two view , first with GDI+ and Second with OpenGL.
Is there any conflict between these ?
and Can i do that ?
Best Regards,
|
|
|
|
|
|
Hi Dears,
I wanna know , how i can access serial and parallel? and if i start to do that
with subject i should learn.
Best Regards,
|
|
|
|
|
mostafa_pasha wrote:
how i can access serial and parallel?
CreateFile()
mostafa_pasha wrote:
with subject i should learn.
I don't understand the question. Developing applications that use communication mechanisms generally requires a broad range of topics.
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|