|
Jeez, even the guys at MS don't know about SetDlgItemText .
I don't know about you, but I find a one-liner much more readable:
SetDlgItemText( IDC_MYEDIT, _T( "Hello World" ) );
Also, there's no need to cast to a CEdit or CStatic pointer if you're just going to be calling a method implemented on CWnd.
|
|
|
|
|
I agree that your solution is much more elegant and readable, but getting a pointer to the control is also a vital step in many other not so basic scenarios.
I figure I better answer the question the way it is most useful, not necessarily in the shortest way. That includes the cast, which might be necessary for other things besides setting the text.
Lorenz Prem
Microsoft Corporation
|
|
|
|
|
Wow!!!
Lorenz Prem
Microsoft Corporation
Does that mean that we are getting an official MSFTs responce now?
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
I try to create thread from thread under FMC.
But sometime it not work (hang).
Maybe someone did it before ???
brainiax@wp.pl
|
|
|
|
|
Post the code that spawns the thread inside another thread.
Kuphryn
|
|
|
|
|
Hi!
I write a console execute in vc. It is called by other command line. How can i make vc ide into debug it when it is been called? How can set a break in some lines?
I believe it is definitely possilbe in vc, but i don't know how to operate.
Thanks!
|
|
|
|
|
To my knowledge, Visual Studio must start the application in order to debug it.
|
|
|
|
|
put __asm{ int 3 }; at the beginning of the code!
when the exception is raised, attach visual studio debugger to it, voila
Don't try it, just do it!
|
|
|
|
|
I am conecting to MYSQL database which is on the server using following code.
CDatabase m_dbftp;
m_dbftp.OpenEx(sDSNName,CDatabase::noOdbcDialog | CDatabase::useCursorLib );
Connection is done properly. I want to catch the exception
when server is disconnected.
I am using following code
catch(CDBException* pEx )
{
CString sz;
if ( pEx->m_nRetCode == AFX_SQL_ERROR_CONNECT_FAIL )
AfxMessageBox("myconnection failed");
}
It dose not work
Problem is m_nRetCode contains -1 instead of
AFX_SQL_ERROR_CONNECT_FAIL .
I am not able to identify if server is disconnected .? How to do it.
|
|
|
|
|
I see a sentence like below:
private Mutex[] m_mutex;
It seems very strange for me
What is its meaning?
Help
Thank you
|
|
|
|
|
Short for MUTual EXclusion. These are used to non-recursively synchronize access to shared resources. Eg: in order to protect a critical section, you can use a mutex, which will ensure that only one thread at a time can lock it.
|
|
|
|
|
It looks like a syntax error to me. The private keyword should have a colon after it, and the square brackets should follow the variable, not the type.
private:
Mutex m_mutex[];
If it's something different, it's new to me.
|
|
|
|
|
DavidCrow wrote:
It looks like a syntax error to me. The private keyword should have a colon after it, and the square brackets should follow the variable, not the type.
private: Mutex m_mutex[];
If it's something different, it's new to me.
I think that's Java, or may C#. In Java, you denote the accessability of each member explicitly. Correct me if I'm wrong, its been a while since I used Java, arrays of a type are written as TypeName[] variableName.
|
|
|
|
|
|
You can find the codes at the following site:
http://www.codeproject.com/useritems/inprocsemaphore.asp?target=semaphore
|
|
|
|
|
Shouldn't C# questions be posted to the C# forum instead of the VC++ forum? You're bound to get more answers that way!
|
|
|
|
|
Is there any way to programatically set/unset fullscreen console mode?
Neil
|
|
|
|
|
hi..
this way is not exactly same yours however you can use.
<br />
void CMainFrame::OnViewFullscreen() <br />
{<br />
if (m_fullscreen)<br />
{<br />
ModifyStyle(0,WS_CAPTION|WS_THICKFRAME); <br />
ShowWindow(SW_SHOWNORMAL);<br />
<br />
ShowControlBar(&m_wndToolBar, TRUE, FALSE);<br />
ShowControlBar(&m_wndStatusBar, TRUE, FALSE);<br />
}<br />
else<br />
{<br />
ModifyStyle(WS_CAPTION|WS_THICKFRAME,0); <br />
ShowWindow(SW_MAXIMIZE);<br />
<br />
CFrameWnd* pChild = GetActiveFrame();<br />
if (pChild) pChild->ShowWindow(SW_MAXIMIZE);<br />
<br />
ShowControlBar(&m_wndToolBar, FALSE, FALSE);<br />
ShowControlBar(&m_wndStatusBar, FALSE, FALSE);<br />
}<br />
m_fullscreen = !m_fullscreen;<br />
}
|
|
|
|
|
Erm, I was after full screen mode for console (text mode) programs, not GUI
Neil
|
|
|
|
|
hm.. I never did it, but perhaps by finding the window of the
console. and then sending "Alt+Enter" to it?!?
Use EnumWindows(), So you can find the ConsoleWindow. it has
the name of your app in the title.
and then send the "go full screen" magic "Alt+Enter"
|
|
|
|
|
Functional but not very elegant - this sends a Ctrl+Enter to the console window:
<br />
#include <windows.h><br />
#include <conio.h><br />
<br />
int _tmain(int argc, _TCHAR* argv[])<br />
{<br />
keybd_event( VK_MENU, MapVirtualKey( VK_MENU, 0 ), 0, 0 );<br />
keybd_event( VK_RETURN, MapVirtualKey( VK_RETURN, 0 ), 0, 0 );<br />
keybd_event( VK_RETURN, MapVirtualKey( VK_RETURN, 0 ), KEYEVENTF_KEYUP, 0 );<br />
keybd_event( VK_MENU, MapVirtualKey( VK_MENU, 0 ), KEYEVENTF_KEYUP, 0 );<br />
<br />
<br />
getch();<br />
return 0;<br />
}
Displaced Aussie. Currently in London, normally living in Melbourne.
modified 10-Jul-19 21:02pm.
|
|
|
|
|
what is a SAFEARRAY?
I am having a hard time understanding the little documentation that I have found. I am interested in constructing one because of this function I have found...
<br />
int CFacedetectApp::RCobj_detectfaces(SAFEARRAY **bmp)<br />
{ <br />
BYTE *bmp2;<br />
int i;<br />
<br />
SafeArrayLock(*bmp);<br />
<br />
bmp2 = (BYTE *)(*bmp)->pvData;<br />
<br />
for (i=0;i<width*height*3;i++) video_image[flip]->imageData[i] = bmp2[i]; <br />
<br />
if (!trackingEnabled)<br />
DetectFaces(video_image[flip]);<br />
else<br />
updateTracking();<br />
<br />
flip = 1-flip;<br />
<br />
SafeArrayUnlock(*bmp);<br />
<br />
return(NoOfObjects);<br />
}<br />
The code is from....
http://www.fuzzgun.btinternet.co.uk/rodney/components.htm#FaceDetection[^]
Why is it so hard just to give a function a simple file name and let it do it's detection
I like his .dlls because they are simplified but I am having trouble understanding them. any help would be great. thanks
Later, JoeSox www.humanaiproject.org
"The worst fad has been these stupid little robots,
Graduate students are wasting 3 years of their lives
soldering and repairing robots, instead of making them smart.
It's really shocking." -Marvin Minsky.
|
|
|
|
|
It's sort of the VB/COM/DISPATCH array type. If you're in MFC, COleSafeArray can be used to manage SAFEARRAYs more easily.
--
Ian Darling
|
|
|
|
|
Ian Darling wrote:
It's sort of the VB/COM/DISPATCH array type. If you're in MFC, COleSafeArray can be used to manage SAFEARRAYs more easily.
ah, perfect thanks, I'll start reading up on COleSafeArray.
Later, JoeSox www.humanaiproject.org
"The worst fad has been these stupid little robots,
Graduate students are wasting 3 years of their lives
soldering and repairing robots, instead of making them smart.
It's really shocking." -Marvin Minsky.
|
|
|
|
|
hello,
I have a big problem ... I have created a MFC app from wizard ... and added:
void CEditorView::OnInitialUpdate()
{
CScrollView::OnInitialUpdate();
CSize sizeTotal;
// TODO: calculate the total size of this view
sizeTotal.cx = widthMM;
sizeTotal.cy = heightMM;
SetScrollSizes(MM_LOMETRIC, sizeTotal);
}
so, my maping mode is MM_LOMETRIC ...
and in OnDraw ....
void CEditorView::OnDraw(CDC* pDC)
{
CEditorDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
CDC bdc;
bdc.CreateCompatibleDC(pDC);
CBitmap cb;
cb.CreateCompatibleBitmap(pDC, 1000,1000);
bdc.SelectObject(cb);
bdc.SelectStockObject(WHITE_BRUSH);
bdc.PatBlt(0,0,1000, 1000, PATCOPY);
bdc.SelectStockObject(BLACK_BRUSH);
bdc.Rectangle(CRect(0, 0, 500, -500));
pDC->StretchBlt(0, 0, 1000, 1000, &bdc, 0, 0, 1000, 1000, SRCCOPY);
}
and nothing happens .... why ?????
I tried to change the sign of the coordonate values and still nothing ...
How can I create a compatible DC with my DC and to paint in it ?????
please help !!!.... thanks ......
|
|
|
|
|