|
Notice anything peculiar:
%s %i %s %i %s %i %s %i %s
day,stLocal.wDay,month,stLocal.wYear,stLocal.wHour,":",stLocal.wMinute,":",stLocal.wSecond
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
How come the guy looking over your shoulder always sees the better picture?
Nice work!
|
|
|
|
|
Is there a way to use some of .Net's numerous classes in MFC?
What I'm particulrly interested is finding a way to use .Net's DataAdapter, DataReader, SqlCommand and so on classes in MFC.
Thank you in advance.
|
|
|
|
|
Dobromir Dimitrov wrote:
Is there a way to use some of .Net's numerous classes in MFC?
Yes.
It's not trivial. To use .NET from C++ you need to understand how .NET works
and how C++ interops unmanaged code with managed code.
The top two links in this programming guide[^] have lots of info.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
You can. Read up on C++/CLI if you use VC 2005, or Managed C++ for earlier versions of VC.
|
|
|
|
|
How to create one dialog box on another in MFC inVC++6.0
|
|
|
|
|
You can use of CreateWindow or use of CDialog class.
|
|
|
|
|
Hi, i want to write an App in which on button click i change size of client area in app window. Something like in some graphic app's when picture is to big the scroll bars appear. I neet client area
much bigger than screen size e.g. 5000x5000 pixels.
My app type is SDI , main window is derrived from CFrameWnd, Style:Child , Borde:Resizing.
Please help.
|
|
|
|
|
zarraza wrote: i want to write an App in which on button click i change size of client area in app window.
You can't.
It's up to you to manage what's displayed in the client area.
If you have more data than fits in the client area, you need to keep track of that.
GDI can help a bit with its window/vieport settings.
Or if you prefer, you can keep track of it yourself, drawing just the visible portion of
your data.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Why you dont want that your dialog has scrollbar?
|
|
|
|
|
What about...
CSize sizeTotal;
sizeTotal.cx = 950; sizeTotal.cy = 1400;
SetScrollSizes(MM_TEXT, sizeTotal);
and make your view derived from CScrollView.
But with SDI you may have problems, frame and client area are connected. You can always try it with an MDI App but limiting the number of opened documents to one. I make it so to have more functionality about client area and multiple views with same document.
In MDI you have the CMainFrame for the App window and the ChildFrame for the main view related with the document. You can change the size of the client area in the BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs) and specify the size of the frame, change caption, properties and so on.
For example in my program.. My main frame (app window) is maximized to screen resolution. Then the MainView frame is 620x420 to be sure it has no problems in any monitor or resolution but te client area is 950x1400 (as I say in the snippet above), afterwards I have different secondary views with different frames size (some fix, some dinamics)
if (m_pDoc->m_szNewFrameName == "PCLayout")
{ cs.cx = 500; cs.cy = (40 + (25 * nMax));
}
else if (m_pDoc->m_szNewFrameName == "SPSMonitor")
{ cs.cx = 525; cs.cy = 300;
}
else if (m_pDoc->m_pObjInput || m_pDoc->m_pObjOutput)
{ cs.cx = 415; cs.cy = 260; }
else if ((m_pDoc->m_pObjRegler) && (m_pDoc->m_pObjRegler->m_nRegType == 0))
{ cs.cx = 517; cs.cy = 421; }
else if ((m_pDoc->m_pObjRegler) && (m_pDoc->m_pObjRegler->m_nRegType == 2))
{ cs.cx = 610; cs.cy = 435; }
Hope it helps
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
My app has to be SDI because it's just a part of bigger SDI app which already exists and what i'm writing now is just for tests.
I want scroll bars on my dialog but on client area (if i clik on right bottom corner of my dialog on runtime and resize it to be smaller then at app start the scroll bars appears in client area), i don't know how to get pointer to client area in sdi app. If on resizing manually (by clicking on corner) scroll bars appears it has to be a way to get the pointer to client area and set some properties on it.
|
|
|
|
|
Hello,
Is there an easy way to embed flash swf files onto a dialog box/interface created by C++/MFC?
I tried doing the opposite (to embed the .exe file onto a flash swf file), but someone commented that it's not supported.
Can someone please point me in the right direction? Basically .. i just need a common window/dialog box to contain both a C++/MFC exe application and a flash swf application.
Thanks in advance!
|
|
|
|
|
ok this is going to be a stupid question to 99.9% of you but i cant figure out what im missing i can not figure out how to add the following
Controlling Function Example
This example shows how to define a controlling function and use it from another portion of the program.
UINT MyThreadProc( LPVOID pParam )
{
CMyObject* pObject = (CMyObject*)pParam;
if (pObject == NULL ||
!pObject->IsKindOf(RUNTIME_CLASS(CMyObject)))
return 1; // if pObject is not valid
// do something with 'pObject'
return 0; // thread completed successfully
}
// inside a different function in the program
.
.
.
pNewObject = new CMyObject;
AfxBeginThread(MyThreadProc, pNewObject);
i always get errors on the UNIT what is the right way to implement the controlling function in vc++ 6? im using mfc
|
|
|
|
|
locoone wrote: i always get errors on the UNIT what is the right way to implement the controlling function in vc++ 6?
What specific errors?
The proper prototype for the thread procedure is
UINT __cdecl MyControllingFunction( LPVOID pParam );
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
thank you very much mark you helped and didnt even know it and you missed where i was messing up
UNIT <--- mine
UINT <--- yours
btw i go it working first try after learning to spell lol
|
|
|
|
|
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
This remind me a maths exam some years ago... 1*1 = 2 ;P;)
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
Hi,
Following code is written in Visual Studio 2005 C++ for PDA(MC3000).
PDA is Motorola/Symbol's MC3000 and it has Windows CE 5.0 Operating System.
FTP Error Code 12029 meaning "Internet can not connect" as per Microsoft Documentation.
I am using following code to do FTP Send file to FTP Server:
int JSCFTPSendFile(TCHAR *tszLocalFileName, TCHAR *tszRemoteFileName)
{
HANDLE hInternetHandle = 0;
HANDLE hFTPHandle = 0;
TCHAR tszFTPServerName[256];
TCHAR tszFTPUserId[51];
TCHAR tszFTPPassword[51];
INTERNET_PORT ipFTPPortNo = 21;
_tcscpy(tszFTPServerName, _T("ftp.myftpserver.com");
_tcscpy(tszFTPUserId, _T("MyUserid");
_tcscpy(tszFTPPassword, _T("MyPassword");
hInternetHandle = InternetOpen(_T("Microsoft Internet Explorer"), INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, INTERNET_INVALID_PORT_NUMBER);
if ( hInternetHandle == 0 )
{
return FALSE;
}
hFTPHandle = InternetConnect(hInternetHandle, tszFTPServerName, ipFTPPortNo, tszFTPUserId, tszFTPPassword, INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0);
if ( hFTPHandle == 0 )
{
InternetCloseHandle(hInternetHandle);
return FALSE;
}
// upto here code works fine but when it executes FtpPutFile() I get Error code 12029
iRetStatus = FtpPutFile(hFTPHandle, tszSendFileName, tszRemoteFileName, FTP_TRANSFER_TYPE_BINARY, 0);
if ( iRetStatus )
{
bFileSent = true;
}
InternetCloseHandle(hFTPHandle);
InternetCloseHandle(hInternetHandle);
return TRUE;
}
In the above function upto "InternetConnect()" code works fine but when it executes "FtpPutFile()" I get Error code 12029.
This code works fine to conect to any standard FTP Server.
I am first connecting to PC using ActiveSync(Version 4.1) and once ActiveSync Connection established I can connect to any FTP Server(Local Network or Remote thru the gateway ) and transmit file. But if I try to send file from PDA(MC3000) to ActiveSync Connected PC(FTP Server Name is V4000) then it does not work.
I tried server name as "ppp_peer", "localhost", "V4000"(which is actual FTP Server Name for the local PC ). and it did not work.
Your help will be greatly appreciated.
Regards,
Dev
|
|
|
|
|
I have view class derived from CScrollView
I set scroll size to ( 0 1999) means total size 2000
When I click on the right or left arrowhead of horizontal scrollbar, it moves to some predetermind number left or right.
What I want is, when I will click any of the arrow head it should move only 4 point left or right. It tried to implement in OnHScroll by using SetScrollPos method. It works for sometime when per click move is higher than some unknown number, when I set perclick move to 4 point, it just ignore it and move to predetermind number per click.
Is there any limitation that it should move atleast to some minimum number per click and if the number set below the minimum number, it just ignore.
Do you any idea how I can set per click move to 4 point.
==============================
int nTemp1, nTemp2;
//int nMax = 1999; just assume it is there
//int nMin = 0;
nTemp1 = GetScrollPos(SB_HORZ);
switch(nSBCode) {
case SB_THUMBPOSITION:
SetScrollPos(SB_HORZ,nPos);
break;
case SB_LINELEFT: // left arrow button
nTemp2 = (nMax - nMin) / 500; //when I set 50, 75, 100, i see the difference
// when I set 500, it don't work, and used default one
if ((nTemp1 - nTemp2) > nMin) {
nTemp1 -= nTemp2;
}
else {
nTemp1 = nMin;
}
SetScrollPos(SB_HORZ,nTemp1);
break;
case SB_LINERIGHT: // right arrow button
nTemp2 = (nMax - nMin) / 500; // same as above comment
if ((nTemp1 + nTemp2) < nMax) {
nTemp1 += nTemp2;
}
else {
nTemp1 = nMax;
}
SetScrollPos(SB_HORZ,nTemp1);
break;
}
============================
msc
|
|
|
|
|
You shouldn't need to handle the scroll messages yourself.
You may as well write your own scrollview class if you're going to
do that.
Maybe use CScrollView::SetScrollSizes() to set page/line scroll amounts instead.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Dear all,
I am a newbie in Visual C++ programming and now I am trying to convert a HTML page into a XHTML page. Is there any built-in library for doing this? If not, is there any simple way to do this?
Thanks a lot
Best regards,
Peishan, Wu
|
|
|
|
|
|
hello,
I have a class derived from CStatic.
I have added scroll bars to this CStatic, but not getting OnHScroll() and OnVScroll() messages in that class...
Can any one tell me, how to get these messages...
|
|
|
|
|
can you just explain a bit clearer?
|
|
|
|