|
See the MSDN example Q193103.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Thank you.
I too got the solution..
LPDEVMODE pDMX = NULL;
CPrintDialog prtdlg(FALSE);
pDMX = (LPDEVMODE)GlobalAlloc(GPTR, sizeof(DEVMODE));
if (!pDMX) {
MessageBox("Out of Memory");
return FALSE;
}
// Initialize the DEVMODE structure.
pDMX->dmSize = sizeof(DEVMODE);
pDMX->dmFields = DM_ORIENTATION;
pDMX->dmOrientation = DMORIENT_LANDSCAPE;
prtdlg.m_pd.hDevMode = pDMX;
|
|
|
|
|
Hi. I have an ActiceX that I’d like to communicate with a web service. I assume it is possible to do it but I don’t know where to start.
I know how to create a web service (using C#) but it’s the call from the “old” ActiveX that’s not clear to me.
_____________________________
...and justice for all
APe
|
|
|
|
|
I assume you're using C++ here. MSDN has instructions for you right here[^]. The consuming of Web Services in C++ is very similar to C#, with the exception that C++ requires wrapper class generation (which is done automatically for you). I hear Visual Studio 2005 is different in this aspect, as the C++/CLI is introduced. Consuming Web Services in this environment is pretty much the same for C# and C++.
-Antti Keskinen
----------------------------------------------
"If we wrote a report stating we saw a jet fighter with a howitzer, who's going to believe us ?"
-- R.A.F. pilot quote on seeing a Me 262 armed with a 50mm Mauser cannon.
|
|
|
|
|
Ok, the tutorial on MSDN starts with:
On the Project menu, click Add Web Reference to display the ...
I'm using Visual Studio 6.0...
_____________________________
...and justice for all
APe
|
|
|
|
|
Ahh, so you're using VS 6.0.
Unfortunately this version of Visual Studio does not have a direct Web Services support, like it doesn't have C# support at all. You need to do everything manually in this version. Manual labor is highly difficult and most prone to errors. In order to efficiently use Web Services, I recommend you to move into Visual Studio 2003 .Net version.
If you must use VS 6, then start by learning SOAP, as it's the "language" of Web Services. Then create an Internet-connection, open a HTTP connection to the Web Service, generate a string that can be interpreted as a SOAP request with the proper parameters, post a HTTP Post command into the service and fetch results with HTTP Get. I'm sorry I can't give any more detailed instructions or specific help, because I've never done this manually. The auto-generated wrapper classes (Add Web Reference) have saved me the task.
-Antti Keskinen
----------------------------------------------
"If we wrote a report stating we saw a jet fighter with a howitzer, who's going to believe us ?"
-- R.A.F. pilot quote on seeing a Me 262 armed with a 50mm Mauser cannon.
|
|
|
|
|
Hi
I have a CString type variable that Content is Numberic
how can get this CString as a Integer?
|
|
|
|
|
Hope this will help You.
Example
CString str = "45" ;<br />
int m ;<br />
m = atoi(str.GetBuffer(str.GetLength() ) );
|
|
|
|
|
That is wrong. DO NOT call GetBuffer() - that returns a "writable" pointer, which you don't need.
CString comes with bucketloads of operater overloads.
CString str = "45" ;
int m ;
m = atoi( (const char *) str);
using System.Beer;
|
|
|
|
|
The cast is not necessary. This will suffice:
int m = atoi(str);
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Indeed. But it's harmless and illustrates the point that atio() wants a *const* char *.
I ought to have written that. I'm lazy.
Merry Xmas;
|
|
|
|
|
atoi(), atof()
Ninety-eight percent of the thrill comes from knowing that the thing you designed works, and works almost the way you expected it would. If that happens, part of you is in that machine.
|
|
|
|
|
Hi,
I am working with Win32 serial communication.
I have an unsigned char array with data
Unsigned char data[7];
data[6] = 0xC0;
data[5] = 0x00;
data[4] = 0x00;
data[3] = 0x00;
data[2] = 0x03;
data[1] = 0x00;
data[0] = 0xA0;
CString szMsg;
szMsg.Format("%02X,%02X,%02X,%02X,%02X,%02X,%02X", data[0], data[1], data[2], data[3], data[4],data[5], data[6]);
OutputDebugString(szMsg);
//A0,00,03,00,00,00,C0 -------------Actual data
I want to append “\r\n” to these characters after copying them into the buffer for writing on the port. When I send data to port I append “\r\n”, so that while recieving, if I get more than two lines I can seperate them out by searching for new line.
Send(data);
I had to use functions like _mbslen , _mbscpy and _mbscat because of unsigned char data type.
I did this way:
bool CPanelInterface::Send( unsigned char* cBuffer)
{
size_t len = _mbslen(cBuffer)+2;
//It is showing len = 3 -------I did not understand this. When I passed a 7 byte array, why it is showing the length as 3.
CString szMsg;
szMsg.Format("%02X%02X%02X%02X%02X%02X%02X", cBuffer[0], cBuffer[1], cBuffer[2],cBuffer[3], cBuffer[4], cBuffer[5], cBuffer[6]);
OutputDebugString("\n ");
OutputDebugString("Send1---");
OutputDebugString(szMsg);
//Send1---A00003000000C0 ---------------correct
unsigned char* myBuffer = new unsigned char[len];
_mbscpy(myBuffer, cBuffer);
The data is getting corrupted here after this call to _mbscpy.
CString szMsg;
szMsg.Empty();
szMsg.Format("%02X%02X%02X%02X%02X%02X%02X", myBuffer[0], myBuffer[1], myBuffer[2],myBuffer[3], myBuffer[4], myBuffer[5], myBuffer[6]);
OutputDebugString("\n ");
OutputDebugString("Send2---");
OutputDebugString(szMsg);
//Send2---A000CDFDFDFDFD -------------- Corrupted myBuffer -> data after copy
szMsg.Empty();
szMsg.Format("%02X%02X%02X%02X%02X%02X%02X", cBuffer[0], cBuffer[1], cBuffer[2],cBuffer[3], cBuffer[4], cBuffer[5], cBuffer[6]);
OutputDebugString("\n ");
OutputDebugString("Send3 After Copy---");
OutputDebugString(szMsg);
//Send3 After Copy---A00003000000C0 ------------------ cBuffer is still having correct data
unsigned char endch[2];
endch[0]= '\r';//\n"};
endch[1]= '\n';
_mbscat(myBuffer, endch);
szMsg.Empty();
szMsg.Format("%02X%02X%02X%02X%02X%02X%02X", myBuffer[0], myBuffer[1], myBuffer[2],myBuffer[3], myBuffer[4], myBuffer[5], myBuffer[6]);
OutputDebugString("\n ");
OutputDebugString("Send4---");
OutputDebugString(szMsg);
//Send4---A00D0ACCCCD010----------_ mbscat is also not working properly.
if(!serial.SendData(myBuffer, len))
{
MessageBox(NULL, "Write Failed", "Serial Library Interaface", 0);
myBuffer = NULL;
delete myBuffer;
return false;
}
serial.FlushPort();
myBuffer = NULL;
delete myBuffer;
return true;
}
I am stuck here and am unable to understand why my buffer is getting corrupted after using these string functions. can anyone please help me to solve this problem.
Thanks in anticipation of information.
Madhavi
|
|
|
|
|
I'm not really motivated to go through your code line by line.
But I don't get why you're working with both CString and also char * buffers and libc string functions. I'd say stick with one or the other.
using _mbs???() functions is wrong. They're for wide character sets, and you're dealing with byte data.
1. You want a \r\n at the end of your string? Put it in your format string:-
CString szMsg;
szMsg.Format("%02X%02X%02X%02X%02X%02X%02X<font color="red">\r\n</font>", cBuffer[0], cBuffer[1], cBuffer[2],cBuffer[3], cBuffer[4], cBuffer[5], cBuffer[6]);
or, you can use CString's "+" operater to join two strings:-
CString szMsg;
szMsg.Format("%02X%02X%02X%02X%02X%02X%02X", cBuffer[0], cBuffer[1], cBuffer[2],cBuffer[3], cBuffer[4], cBuffer[5], cBuffer[6]);
szMsg = szMsg + "\r\n";
2. Not using _mbscpy
I don't know where you get your "len" variable from. But use strcpy() instead.
unsigned char* myBuffer = new unsigned char[len];
strcpy(myBuffer, cBuffer);
Those things should help.
Jon
using System.Beer;
|
|
|
|
|
Hello!everyone!how to use a web serivce which is produced by java in VC6.0?If you kinow ,please tell me more about it .Thanks a lot !
|
|
|
|
|
Hi all,
I want to create a ActiveX using mfc.
and I want to add a dialog and some objects,
to my dialog and when I Insert this activex
in my project the dialog and those objects should
add to my app.
Best Regards.
Thanks.
|
|
|
|
|
Hello everyone:
I program code in Japanese OS. And I found that CEdit::LineLength() can not return total bytes of one line. The function returns total character number of one line.
Example:
1. "1234日本90" --->>> LineLength -> 8
2. "1234567890" --->>> LineLength -> 10
About Example 1, it should return 10 but the result is 8.
Is it right? or I need to set up something?
Thanks.
-Freehawk
|
|
|
|
|
I do not know an exact answer to your problem, but I'm fairly certain it is Unicode related. With Unicode, each character consumes two bytes, which is why example 1 is two bytes short of what you expect. You might try defining both UNICODE and _UNICODE in your project's stdafx.h file.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
hi everybody,
Can any one of u help me to brushing on a ownder draw button
I have few owner draw buttons on a dialogbox which is created in an SDI application and now i want to change the color of the buttons
can any one tell me what code do i need to write for that my code is as follow
void MybutCls::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
::DrawFrameControl(lpDrawItemStruct->hDC, &lpDrawItemStruct->rcItem, DFC_BUTTON,DFCS_BUTTONPUSH|BS_DEFPUSHBUTTON);
//what should i add here
if(((0x8000 ==(0x8000 & GetKeyState(16))&& !caps)) || ((0x8000 ==(0x8000 & GetKeyState(16))&& caps)))
{
if(lpDrawItemStruct->CtlID==IDC_BUTTON49)
::DrawText(lpDrawItemStruct->hDC,"!",1,&lpDrawItemStruct->rcItem, DT_SINGLELINE|DT_VCENTER|DT_CENTER);
if(lpDrawItemStruct->CtlID==IDC_BUTTON45)
::DrawText(lpDrawItemStruct->hDC,"_",1,&lpDrawItemStruct->rcItem, DT_SINGLELINE|DT_VCENTER|DT_CENTER);
if(lpDrawItemStruct->CtlID==IDC_BUTTON39 )
::DrawText(lpDrawItemStruct->hDC,"\"",1,&lpDrawItemStruct->rcItem, DT_SINGLELINE|DT_VCENTER|DT_CENTER);
if(lpDrawItemStruct->CtlID==IDC_BUTTON44)
::DrawText(lpDrawItemStruct->hDC,"<",1,&lpDrawItemStruct->rcItem, DT_SINGLELINE|DT_VCENTER|DT_CENTER);
if(lpDrawItemStruct->CtlID==IDC_BUTTON46)
::DrawText(lpDrawItemStruct->hDC,">",1,&lpDrawItemStruct->rcItem, DT_SINGLELINE|DT_VCENTER|DT_CENTER);
if(lpDrawItemStruct->CtlID==IDC_BUTTON47)
::DrawText(lpDrawItemStruct->hDC,"?",1,&lpDrawItemStruct->rcItem, DT_SINGLELINE|DT_VCENTER|DT_CENTER);
if(lpDrawItemStruct->CtlID==IDC_BUTTON48)
::DrawText(lpDrawItemStruct->hDC,")",1,&lpDrawItemStruct->rcItem, DT_SINGLELINE|DT_VCENTER|DT_CENTER);
if(lpDrawItemStruct->CtlID==IDC_BUTTON50)
::DrawText(lpDrawItemStruct->hDC,"@",1,&lpDrawItemStruct->rcItem, DT_SINGLELINE|DT_VCENTER|DT_CENTER);
if(lpDrawItemStruct->CtlID==IDC_BUTTON51)
::DrawText(lpDrawItemStruct->hDC,"#",1,&lpDrawItemStruct->rcItem, DT_SINGLELINE|DT_VCENTER|DT_CENTER);
if(lpDrawItemStruct->CtlID==IDC_BUTTON52)
::DrawText(lpDrawItemStruct->hDC,"$",1,&lpDrawItemStruct->rcItem, DT_SINGLELINE|DT_VCENTER|DT_CENTER);
if(lpDrawItemStruct->CtlID==IDC_BUTTON53)
::DrawText(lpDrawItemStruct->hDC,"%",1,&lpDrawItemStruct->rcItem, DT_SINGLELINE|DT_VCENTER|DT_CENTER);
if(lpDrawItemStruct->CtlID==IDC_BUTTON54)
::DrawText(lpDrawItemStruct->hDC,"^",1,&lpDrawItemStruct->rcItem, DT_SINGLELINE|DT_VCENTER|DT_CENTER);
if(lpDrawItemStruct->CtlID==IDC_BUTTON55)
::DrawText(lpDrawItemStruct->hDC,"&",1,&lpDrawItemStruct->rcItem, DT_SINGLELINE|DT_VCENTER|DT_CENTER);
if(lpDrawItemStruct->CtlID==IDC_BUTTON56)
::DrawText(lpDrawItemStruct->hDC,"*",1,&lpDrawItemStruct->rcItem, DT_SINGLELINE|DT_VCENTER|DT_CENTER);
if(lpDrawItemStruct->CtlID==IDC_BUTTON57)
::DrawText(lpDrawItemStruct->hDC,"(",1,&lpDrawItemStruct->rcItem, DT_SINGLELINE|DT_VCENTER|DT_CENTER);
if(lpDrawItemStruct->CtlID==IDC_BUTTON59)
::DrawText(lpDrawItemStruct->hDC,":",1,&lpDrawItemStruct->rcItem, DT_SINGLELINE| DT_VCENTER|DT_CENTER);
}
Request to all to continue this
|
|
|
|
|
I am trying to encrypt a video file (any format)using my own algorithm. I want to know how could I get the data of video file. Is there any class or library available that can give me direct access to video file data. Is there any available DirectShow Class Library available for directly accessing video data?
I don't want to change the header of the file. Just need direct access to the video data (in binary) so that i can apply my encryption algorithm on it.
Thanks
Naveed
|
|
|
|
|
If you wish to use DirectShow, then the method is to generate a playback graph that first has a source filter (the video file), then possible decoding filters to get raw video data, then a Sample Grabber filter, which allows access to the samples passing through the graph and a Null Renderer filter, which will discard the original samples.
Then, using the Sample Grabber, grab every frame of the video, pass it through your encoding algorithm, and manually write a file. The filter provides a callback for an user-specified function whenever it receives a sample, so no data will be lost. Unfortunately, as far as I know, you cannot reinsert your encoded samples back into the same graph. You must manually write a file header and the actual file.
The final (and most difficult) option is to write a DirectShow filter using your algorithm. This is very similar to writing an encoding/decoding filter. The raw data comes from the input pin, is encrypted, and passes from the output pin. You can then insert an AVI Mux filter and a file writer filter to have a fully functioning encrypting graph. This is the most efficient way, but may require some learning and trial & error procedures.
-Antti Keskinen
----------------------------------------------
"If we wrote a report stating we saw a jet fighter with a howitzer, who's going to believe us ?"
-- R.A.F. pilot quote on seeing a Me 262 armed with a 50mm Mauser cannon.
|
|
|
|
|
I use lex and yacc generate 3 files and want to ues those files in my MFC project.
however, it doesn't work.
How to connect them?
|
|
|
|
|
Chenbuaa wrote:
however, it doesn't work.
What exactly is it that does not work?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hello:
I have an application that makes heavy use of many double buffered images that are dynamicly updated in real time (GDI). I have created the compatible DC's and CBitmaps. I think that I have properly closed all resources as soon as I use them. However when I reach around 64 of these double buffered DC's my application hard-crashes windows with a reboot, and a message in system font that resources have been used up. Is there a limit to the DC stored or is this a symptom of something I am not releasing properly?
|
|
|
|
|
There is a limit to how many DCs can be created at one time, and you just found it . You must use as few DCs as possible, and release them as soon as you're finished with them. You don't need a single DC per bitmap, just select the bitmaps into one DC as you need them. I recommend creating and destroying the compatible DC each time in your drawing method, rather than creating and storing it for later use.
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"
|
|
|
|
|