|
I'm already familiar with the basics of c++ like pointers, multiple inheritance,... but nothing with "windows".
For the last couple of years, I've been programming in java, and I dare to say this, I know it all (almost ).
My question is this: Are there any migration tutorials for java -> c++/vc++?
Bluute tette!
|
|
|
|
|
i know where you are coming from, i developed in java for a year er so.. switched to VC++ a few months ago.. i think once im done with my current project ill be switching to C#.. maybe you should take a look at it as well..
-dz
|
|
|
|
|
The only ide that I've got is visual studio 6, so I'll probably stick to it.
Actually, I don't know c# at all, so I'm gonna take a look
Bluute tette!
|
|
|
|
|
Windows is an event driven environment, virtually identical to AWT. MFC is a thin object oriented layer over the Win32 API. The development tools (esp. the resource editor) are nicer than tools used to develop Java.
You might find C# to be a better migration path. It's more in line with Java - similar syntax, concepts and a reasonably extensive (imho) class library.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hi,
I have a socket client which will send data ( raw bytes followed by HTTP request) to the IIS server.
EX: the packet would be something like this,
"Binarydata(96 bytes)GET /myserver/myserver.asp?val1=v1&val2=v2 HTTP1.0 /n/n"
The above data represents some Binarydata of 96 bytes followed immediately by HTTP request reaching the
server page myserver.asp through the IIS Server.
If this data is sent directly( without filter) from the socket client to the Server , the IIS server would not interpret the
request, as the actual "GET" request is preceeded by some Binarydata.
I need help in the approach for developing an ISAPI Filter which satisfies the following criteria,
1. The ISAPI dll would run in between the IIS server and the Socket Client application.
2. It would capture all the bytes that is sent from the Socket Client application to the IIS server, strip out the 96 bytes & process it.
I would also like to know if ISAPI is the right approach.
Thanks for reading . Eagerly Expecting replies
regards
raja
|
|
|
|
|
I'm trying to update the filename extension on the Filesave dialog box from the OFNOTIFY whenever I select a filetype in the combobox.
Thanks
|
|
|
|
|
Hi all,
What's the best collection class for CPoint objects?
Index is not important, only i need is tail and head.
Thank you.
|
|
|
|
|
hi!
2 questions about UNICODE:
1. I have to convert char* based strings into TCHAR* (that is UNICODE) ones. THe Macro _T() only works for immediate strings such as "Hello" but not with variables, and a cast in (TCHAR *) or even (unsigned short*) mostly destructs what is written in the string (i.e. i got garbage in my string instead of hello, which i think is quite normal.). Any suggestion ?
2. Does it exist an equivalent to atoi() for UNICODE strings ?
Thanxx
RaGe
Unfortunately, brute-force solutions tend to be slow
even when performed by modern-day microcomputers,
which are capable of several MIPS except when I'm late
for an appointment and want to finish a compile and
run just one more test before I leave, in which case
the crystal in my computer is apparently designed to
automatically revert to 1 Hz.
-- Michael Abrash
|
|
|
|
|
Well, first TCHAR is not a UNICODE. It will be converted to unicode only if you compile your program as unicode.
If you want to convert ANSI to UNICODE and vise versa strings, I'd suggest to use bstr_t class. It excepts both and can return both of types.
As for atoi for unicode, so it is wtoi or _ttoi for TCHAR (determined in time of compilation)
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
Need Web-based database administrator? You already have it!
|
|
|
|
|
1- ATL (and I think also MFC) comes with a bunch of macros:
An excerpt from MSDN library:
ATL 3.0 String Conversion Macros
The original text conversion macros are still available and are listed in the table below:
ATL 3.0 String Conversion Macros
A2BSTR OLE2A T2A W2A
A2COLE OLE2BSTR T2BSTR W2BSTR
A2CT OLE2CA T2CA W2CA
A2CW OLE2CT T2COLE W2COLE
A2OLE OLE2CW T2CW W2CT
A2T OLE2T T2OLE W2OLE
A2W OLE2W T2W W2T
All those macros map Ascii (A), OLE (OLE), and Wide (W) strings to another type.
Ex.
USES_CONVERSION;
_TCHAR *tsz = _T("hello world");
WCHAR *wsz = T2W(tsz);
LPOLESTR *olesz = W2OLE(wsz);
char *sz = OLE2A(olesz);
BSTR bsz = A2BSTR(sz);
Don't forget the USES_CONVERSION macro. You don't need to free memory, except for the X2BSTR ones, which require a call to SysFreeString function.
2-
_wtoi (and _ttoi for the _TCHAR ones).
Michel
If I am wrong or said something stupid, I apologize in advance
|
|
|
|
|
strange to see how html does not look like it should be
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
I have been looking for how to print multiple pages, and i see references to printing without using document/view, and using the StartPage() command for each page..
i have looked through all of the CView documentation and nowhere in there do they use StartPage() or StartDoc()...
can someone tell me where i would use this StartPage() command if i was using the Document/View archetecture, or if there is a different way to print multiple pages when using it?
thanks in advance!
-dz
|
|
|
|
|
StartPage() is a call that can be made to a printer DC object when printing. I have an example here:
void COpenGLCtrl::OnPrint()
{
CPrintDialog dlg(FALSE) ;
if (dlg.DoModal() == IDOK)
{
CreateBitmap() ;
CDC dc ;
dc.Attach(dlg.GetPrinterDC()) ;
DOCINFO di ;
CString new_text ;
CPrintInfo printInfo ;
CString title ;
GetWindowText(title) ;
new_text.Format("Printing Graph\"%s\"", title) ;
di.cbSize = sizeof(DOCINFO) ;
di.lpszDocName = new_text ;
di.fwType = 0 ;
di.lpszDatatype = NULL ;
di.lpszOutput = NULL ;
dc.StartDoc(&di) ;
dc.StartPage() ;
printInfo.m_rectDraw.left = 0 ;
printInfo.m_rectDraw.top = 0 ;
printInfo.m_rectDraw.right = dc.GetDeviceCaps(HORZRES) ;
printInfo.m_rectDraw.bottom = dc.GetDeviceCaps(VERTRES) ;
HeaderFooter(&dc, &printInfo) ;
int cxInch = dc.GetDeviceCaps(LOGPIXELSX) ;
int cyInch = dc.GetDeviceCaps(LOGPIXELSY) ;
CRect rectTo ;
rectTo.left = printInfo.m_rectDraw.left ;
rectTo.top = printInfo.m_rectDraw.top ;
rectTo.right = printInfo.m_rectDraw.right ;
rectTo.bottom = (int)( ((double)m_sizes.cy * printInfo.m_rectDraw.Width() * cyInch) / ((double)m_sizes.cx * cxInch)) ;
if (rectTo.bottom > printInfo.m_rectDraw.bottom)
{
rectTo.top = printInfo.m_rectDraw.top ;
rectTo.bottom = printInfo.m_rectDraw.bottom ;
int width = (int)( ((double)m_sizes.cx * printInfo.m_rectDraw.Height() * cxInch) / ((double)m_sizes.cy * cyInch)) ;
rectTo.left = printInfo.m_rectDraw.left + (printInfo.m_rectDraw.Width() - width) / 2 ;
rectTo.right = rectTo.left + width ;
}
::StretchDIBits(dc.m_hDC,
rectTo.left, rectTo.top, rectTo.Width(), rectTo.Height(),
0, 0, m_sizes.cx, m_sizes.cy,
m_pPixelData, &m_bmi, DIB_RGB_COLORS, SRCCOPY );
dc.EndPage() ;
dc.EndDoc() ;
VERIFY(dc.DeleteDC()) ;
DestroyBitmap() ;
}
}
The above is an example for an OpenGL Ctrl I have which prints the image to a printer. It also in some ways emulates the MFC code as it uses the CPrintInfo structure to gather information about the printable area. It covers all the basics of what you need I think.
Roger Allen
Sonork 100.10016
yet to be identified being from the planet Paltinmoriumbanfrettybooter
|
|
|
|
|
Different to my previous answer.
The MFC doc/view handles the printing using the following functions:
OnPreparePrinting()
OnBeginPrinting()
OnPrint() // by default this calls your views OnDraw()
OnEndPrinting()
In your OnPreparePrinting you need to setup the CPrintInfo structure with the number of pages you wish to print:
pInfo->SetMaxPage(5) ;
The MFC code will then call your OnPrint() function once per page. It will have done the calls to StartDoc() and StartPage/EndPage() for you. You will need to look in the pInfo->m_nPage member to see which page is being printed. From this info you can determine which data to print.
OnBeginPrinting and OnEndPrinting are only used if you need to configure the output DC etc for a special print operation.
Roger Allen
Sonork 100.10016
yet to be identified being from the planet Paltinmoriumbanfrettybooter
|
|
|
|
|
Look at the MSDN article "CView::OnFilePrint and Other Command Handlers". It has a flowchart of the CView printing architecture.
Jonathan Craig
www.mcw-tech.com
|
|
|
|
|
I need to know the inf file that is equivalent to ntprint.inf in NT and Win2000. I am in need of diff. printer info and their driver files.
Can any one tell me what is pconfigfile while installing printer driver programmatically(AddPrinterDriver). Can i use any default file for this parameter, if so what is it for Win98,2000,me,nt ?
Please advise ....
Thanks in advance.
Somu.l
|
|
|
|
|
Hello world! I am stuck. Any help is highly appreciated.
Here is the situation:
I have 3 dialog box in a tab setting. base dialog has a
tab control, one edit control, and 4 buttons (Ok,Cancel,
Show, Populate).
PageOne dialog has a text control, and PageTwo has one text
control. All I want is: if I press Show button which is on
the basePage dialog, I want to see contents of all text controls
(basePage, PageOne, PageTwo).
If I press Populate button, I want to populate all text controls
of three dialogs (basePage, PageOne, PageTwo).
If you need more clarification, please send me a mail.
Thank you in advance.
|
|
|
|
|
you should be able to use pDlg->GetDlgItem to get to those controls.
-c
Conscience is what hurts when everything else feels good.
Smaller Animals Software, Inc.
|
|
|
|
|
As a new in VC, how to use it?
|
|
|
|
|
CString strTemp;
CEdit* pText1 = (CEdit*)GetDlgItem(IDC_TEXTBOX1);
pText1->GetWindowText(strTemp); // put value in textbox into strTemp string
pText1->SetWindowText("text"); // put text into textbox
i think you then have to call: UpdateData(true);
for the boxes to update
-dz
|
|
|
|
|
Hello dz:
sorry this does not work, got Assertion fail or illegal operation.
Thanks,
|
|
|
|
|
I'm writing a program about voice communication by DirectPlay8,and I found it's difficult to access address by IP,There are two interfaces IDirectPlay8Address & IDirectPlay8AddressIP,but when I use IDirectPlay8Peer to connect to a server, I can only use the the IDirectPlay8Address,How could I pass the parmeter to IDirectPlay8Peer::Connect using IDirectPlay8AddressIP,because I will look up the IP address in a database,so I don't want the user to input a IP,I want to access to IDirectPlay8AddressIP by a string.
So I need your help, how can I use IDirectPlay8AddressIP for connection.
Thanks a lot,
|
|
|
|
|
Hi There!
I've just started writing a CWnd derrived custom control, but I want it by default to have the WS_EX_CLIENTEDGE style. I tried doing this routine...
void CFooCtrl::PreSubclassWindow()
{
CWnd::PreSubclassWindow();
ModifyStyleEx(0, WS_EX_CLIENTEDGE);
}
But for some reason it doesn't work properly. Don't worry, I have checked whether the function is being called or not, and it is. Also, I tried in the dialog resource editor putting the hex of WS_EX_CLIENTEDGE style in the code box for my custom control, and it did produce the desired result. But I would like to have the style hard-coded. Does anyone know why the ModifyStyleEx function seems to be having not effect?
Any Help is much appreciated.
With time we live, with money we spend!
Joel Holdsworth
|
|
|
|
|
Try moving the stuff to CFooCtrl::PreCreateWindow .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi,
Yeah, problem with PreCreateWindow is that for controls in a dialog, PreCreateWindow is never called. Probably somthing to do with the window being creatded before the point where CFooCtrl picks it up. Very irritating. But thanks for the advice...
With time we live, with money we spend!
Joel Holdsworth
|
|
|
|