|
|
To get the text of a combobox item I'm currently using the code below:
m_cbCommand.GetLBText (m_cbCommand.GetCurSel (), csItem) I'm just curious as to if this is the best way to be doing this? I didn't really see any other related methods to get the text, but the way I'm using seems clunky. Thanks for any ideas.
- monrobot13
|
|
|
|
|
Nothing wrong in the code. Its perfectly legal.
I have lost more blood shaving than on the battlefield - Adolf Hitler
|
|
|
|
|
monrobot13 wrote:
I'm just curious as to if this is the best way to be doing this?
It's not. Use GetWindowText() instead. Depending on the style of combobox used, GetLBText() will not always get the text in the edit control.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Ah, that's sounds much better. Didn't even think of that. Thanks.
- monrobot13
|
|
|
|
|
// Show head
if (features->Head.bHeadFound)
{
const SHeadFeatures *pHead = &features->Head;
// Show head features (by green color)
if (pHead->bHeadSizeFound)
{
image.DrawMarker(pHead->iHeadTopX,pHead->iHeadTopY, sz,0, 0x00ff00);
image.DrawMarker(pHead->iHeadLeftX, pHead->iHeadLeftY, sz,0, 0x00ff00);
image.DrawMarker(pHead->iHeadRightX, pHead->iHeadRightY, sz,0,0x00ff00);
image.DrawMarker(pHead->iChinCenterX, pHead->iChinCenterY, sz,0, 0x00ff00);
image.DrawMarker(pHead->iChinLeftX, pHead->iChinLeftY, sz,0, 0x00ff00);
image.DrawMarker(pHead->iChinRightX, pHead->iChinRightY, sz,0, 0x00ff00);
}
if (pHead->bLeftTempleFound)
image.DrawMarker(pHead->iTempleLeftX, pHead->iTempleLeftY, sz,0, 0x00ff00);
if (pHead->bRightTempleFound)
image.DrawMarker(pHead->iTempleRightX,pHead->iTempleRightY, sz,0, 0x00ff00);
if (pHead->bSplFaceFound)
DrawSpline(pHead->hSpl_face,image,0x00ff00);
// Show head bounding box (by green color)
if (pHead->bBoundsFound)
{
image.DrawRect(features->Head.iLeftTopBoundX, features->Head.iLeftTopBoundY,
features->Head.iRightTopBoundX, features->Head.iRightTopBoundY,
features->Head.iLeftBotBoundX, features->Head.iLeftBotBoundY,
features->Head.iRightBotBoundX, features->Head.iRightBotBoundY,0x00ff00);
image.DrawLine(pHead->iFaceLeftTopBoundX, pHead->iFaceLeftTopBoundY,
pHead->iFaceRightTopBoundX, pHead->iFaceRightTopBoundY,0x00ff00);
}
}
CAN SOMEONE EXPLAIN TO ME THIS SET OF CODE
THANK ALOT
|
|
|
|
|
Why does it need any explanation??? Just compile and run it you will see it on the screen.
is it C#?
I have lost more blood shaving than on the battlefield - Adolf Hitler
|
|
|
|
|
Goh Hui Beng wrote:
CAN SOMEONE EXPLAIN TO ME THIS SET OF CODE
no, I won't, at least not right now, please ask a more specific question, what's the problem, what exactly you don't understand ?
it seems to be quite explicit ...
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
ok my problem is that i want this code to output some specific points like iLipBottomX the coordinate value.
but this code actually detects and draws out the picture.
From this can u deduce wat variable must i printf to get the result i want?
The SMouthFeature structure contain these variable
bool bMouthFound; // Mouth finding flag
bool bSplMouthFound; // Mouth spline finding flag
HSPLINE hSpl_mouth; // Mouth spline handle
bool bSplLipTopFound; // Top lip spline finding flag
HSPLINE hSpl_lip_top; // Top lip spline handle
bool bSplLipBottomFound; // Bottom lip spline finding flag
HSPLINE hSpl_lip_bottom; // Bottom lip spline handle
bool bLipTopFound; // Top lip point finding flag
int iLipTopX; // x coordinate of the top lip point
int iLipTopY; // y coordinate of the top lip point
bool bMouthCenterFound; // Mouth center finding flag
int iMouthCenterX; // x coordinate of the mouth center
int iMouthCenterY; // y coordinate of the mouth center
bool bLipBottomFound; // Bottom lip point finding flag
int iLipBottomX; // x coordinate of the bottom lip point
int iLipBottomY; // y coordinate of the bottom lip point
bool bMouthLeftCornerFound; // Mouth left corner finding flag
int iLeftCornerX; // x coordinate of the mouth left corner
int iLeftCornerY; // y
u understand or do u need further info i can provide
|
|
|
|
|
Hi
in my application i try to set an printer fonts.From msdn i took this example how it do.
CHOOSEFONT cf;
LOGFONT lf;
HFONT hfont;
// Initialize members of the CHOOSEFONT structure.
cf.lStructSize = sizeof(CHOOSEFONT);
cf.hwndOwner = (HWND)NULL;
cf.hDC = (HDC)NULL;
cf.lpLogFont = &lf;
cf.iPointSize = 0;
cf.Flags = CF_SCREENFONTS;
cf.rgbColors = RGB(0,0,0);
cf.lCustData = 0L;
cf.lpfnHook = (LPCFHOOKPROC)NULL;
cf.lpTemplateName = (LPSTR)NULL;
cf.hInstance = (HINSTANCE) NULL;
cf.lpszStyle = (LPSTR)NULL;
cf.nFontType = SCREEN_FONTTYPE;
cf.nSizeMin = 0;
cf.nSizeMax = 0;
// Display the CHOOSEFONT common-dialog box.
ChooseFont(&cf);
// Create a logical font based on the user's
// selection and return a handle identifying
// that font.
hfont = CreateFontIndirect(cf.lpLogFont);
//After this i has hfont variable vary by NULL,and try to
//select it into printer device context m_hPrinterDC
//(this variable was initialized early and
//also have a proper value,because of when i output text
//on one or do any other acts all work fine.
//In this step i try to select created logical font into dc
HGDIOBJ hf1 = SelectObject(m_hPrinterDC,&hfont);
//This function return NULL,what meant an error.
Where is my fault?????
Also i try to change some params in cf structure like this:
cf.hDC = m_hPrinterDC;
cf.Flags = CF_PRINTERFONTS;
cf.nFontType = PRINTER_FONTTYPE;
But result exactly same.
Thanks.
|
|
|
|
|
Search Article on Microsoft website -> "How To Use Printer Device Fonts"
It might be of help, if need to use Printer Font.
|
|
|
|
|
I create followng:
CDialog dlg;
dlg.Create(IDD.pWnd);
dlg appears, but I neeed to hide it,
I made following:
but no resilt,
how to do it?
<br />
int cWaitDlg::OnCreate(LPCREATESTRUCT lpCreateStruct)<br />
{<br />
<br />
<br />
this->ModifyStyle(WS_VISIBLE,0,0);<br />
<br />
lpCreateStruct->style |= WS_VISIBLE;<br />
lpCreateStruct->style -= WS_VISIBLE;<br />
<br />
this->ShowWindow(SW_HIDE);<br />
<br />
if (__super::OnCreate(lpCreateStruct) == -1)<br />
return -1;<br />
<br />
<br />
<br />
return 0;<br />
}<br />
<br />
BOOL cWaitDlg::PreCreateWindow(CREATESTRUCT& cs)<br />
{<br />
<br />
cs.style |= WS_VISIBLE;<br />
cs.style -= WS_VISIBLE;<br />
<br />
int j = cs.style & WS_VISIBLE;<br />
<br />
return __super::PreCreateWindow(cs);<br />
}<br />
<br />
<br />
|
|
|
|
|
vgrigor wrote:
this->ModifyStyle(WS_VISIBLE,0,0);
lpCreateStruct->style |= WS_VISIBLE;
lpCreateStruct->style -= WS_VISIBLE;
this->ShowWindow(SW_HIDE);
What are you trying to do here? If you want the window to be hidden, why not just remove the WS_VISIBLE style from the dialog template? Otherwise, the code you have makes no sense. Note this may not work as CDialog::OnInitDialog() "shows" the window explicitly.
vgrigor wrote:
if (__super::OnCreate(lpCreateStruct) == -1)
Is this a construct for Windows CE? Just curious.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Removing style not prevent from appearing,
so that even I hide by comman Window will flick one moment,
and that is problem.
Need to to appear at any.
Until commanded else.
|
|
|
|
|
vgrigor wrote:
Removing style not prevent from appearing...
I suspected such.
vgrigor wrote:
Need to to appear at any.
Until commanded else.
What does this mean?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Sorry I did notinitially
typed text question:
now I added it:
I create followng:
CDialog dlg;
dlg.Create(IDD.pWnd);
dlg appears, but I neeed to hide it,
with no any time of apperiance,
I made following: code above...
but no resilt,
how to do it?
|
|
|
|
|
Derive a class from CDialog using the dialog template. In that class' constructor, call Create(IDD) .
CMyDialog *pDlg;
...
pDlg->ShowWindow(SW_SHOW);
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Why create a dialog any way when its going to be hidden? why not create a window using CreateWindow api???
or derive a class from CWnd class and then create it so that you have the power of message mapping of MFC
I have lost more blood shaving than on the battlefield - Adolf Hitler
|
|
|
|
|
Mr.Prakash wrote:
Why create a dialog any way when its going to be hidden?
Why ask me? It's not my project.
Yes, hidden windows do have their place.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
DavidCrow wrote:
Why ask me? It's not my project.
oops sorry i replied to the wrong post.
I have lost more blood shaving than on the battlefield - Adolf Hitler
|
|
|
|
|
It is interesting,
how to use this API for CDialog ?
How to define sizes?
|
|
|
|
|
|
|
Somebody dropped me right solution.
I did not detected who.
Thanks:
http://www.codeproject.com/dialog/dlgboxtricks.asp
|
|
|
|
|
You can replace all of your code with a single overriden function and two lines of code
void CMyDlg::OnWindowPosChanging(WINDOWPOS* lpwndpos)
{
// This is where it all happens
if(!m_bShowWindow)
lpwndpos->flags &= ~SWP_SHOWWINDOW;
CDialog::OnWindowPosChanging(lpwndpos);
}
Simply turn off m_bShowWindow (which obviously needs to be defined and switched) to show the window. This code prevents the dialog from ever being seen in the first place. Unfortunately Win98, Win95 still seem to briefly flicker before disappearing...but who is running those OS's anyway
Hope this information is not too late for others searching the message boards...
|
|
|
|