|
I am confused with SetFont() function.
I followed example code in MSDN, it works well in my laptop.
but, when I same code in my WinCE program, it dont work, font not change, show [] [] [] []
LOGFONT lf; CEdit *pEdit1;
lf.lfHeight = 12;
lf.lfWidth = 0;
memset(&lf, 0, sizeof(LOGFONT)); WCHAR lffn[] = TEXT("Simsun(OpenType)");
wcscpy(lf.lfFaceName,lffn);
lf.lfCharSet = GB2312_CHARSET;
if (m_font2.m_hObject) {
m_font2.DeleteObject();
}
m_font2.CreateFontIndirect(&lf);
pEdit1 = (CEdit *) GetDlgItem( IDC_EDIT1 );
pEdit1->SetFont(&m_font2);
SetDlgItemText(IDC_EDIT1, _T("公里") );
Appreciate any suggestions
|
|
|
|
|
Hi,
The code you pasted here appears to be bugged:
pEdit1 = (CEdit *) GetDlgItem( IDC_EDIT1 );
SetDlgItemText(IDC_INFO_PL, _T("公里") );
Best Wishes,
-David Delaune
|
|
|
|
|
Changed. it is solved, but I don't know the reason. please refer to another question I posted.
|
|
|
|
|
Hi, in a dialog project member function, the results of retGetRect() confused me:
void CTestDlg::RefreshLabels(void)
{
CRect rect;
CEdit1 *pEdit1 = GetDlgItem(IDC_EDIT_TST1);
pEdit1->GetRect(&rect);
}
with breakpoint, I got
[tagRECT] = {top=350682312 bottom=15026448 left=15026448 right=784660}
|
|
|
|
|
Solved, it need to use GetClientRect(); then ClientToScreen()
|
|
|
|
|
Hi everybody!
I'm creating a program which use database.
My problem is: I use ExecuteSQl() to input data into my database but when i run it, I show an error "too few parameters. Expected 1".
CString path(_T("\',\'")), pathInt(_T("','"), rien(_T("NUL"));
reqPer = _T("insert into personne values (2014,\'") + nomPer + path + prenPer + path + datNaissPer + path + liNaisPer + path + domPer + _T("\',") + rien + _T(",\'") + numPiecPer + path + _T('M') + path + profPer + path + natPer + _T("\',") + rien + pathInt + rien + _T(")");
database.ExecuteSQL(reqPer);
|
|
|
|
|
You should check the final value of the reqPer string to see whether the SQL command is correctly formed. I would also strongly suggest you do not create SQL statements in the way you have done, as this leaves your code open to SQL injection, and the potential loss or corruption of your database. See the CRecordSet class[^] for the correct way to do it.
|
|
|
|
|
I saw it, but it's not very clear for me. Please, can you post a sample?!
|
|
|
|
|
Fawaz Ajani wrote: Please, can you post a sample? Sorry, I don't have one. You need to either search for yourself, or spend time reading the documentation.
|
|
|
|
|
It will be correct, if i use this one?
sql.Format("INSERT INTO NomTable (Colone1,Colonn2, ....) VALUES(%d ,'%s','%s', ....)",m_Variable1,m_Variable2, ....);
db->ExecuteSQL(sql);
|
|
|
|
|
This article does not do any writing or updating, but it may help to point you in the right direction.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
|
Please, I have order problem.
when I do this:
CRecordset recordset(&database);
CString temp, query;
query.Format(L"SELECT number FROM personne WHERE numPiece = '%s'", numPiecPer);
recordset.Open(CRecordset::snapshot, query, CRecordset::appendOnly);
while (!recordset.IsEOF())
{
recordset.GetFieldValue((short)0, temp);
messageBox(temp, 0, 0);
recordset.MoveNext();
}
It don't work.
|
|
|
|
|
if a window be hidden,then does it still get messages from windows?
i.e, it's message loop still get/dispatch messages?
|
|
|
|
|
Yes, to both.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
As already stated by the other user, yes. This is actually a common trick people use for getting a message pump wherever they need one, make an invisible window that can be messaged to.
|
|
|
|
|
Hi, I want to change several CEdit's font in a dialog based program. the dialog is a non-modal dialog,in it's OnInitDialog().
BOOL CTestFontDlg::OnInitDialog()
{
CFont * pFontNew;
LOGFONT lf; CEdit *pEdit1;
CEdit *pEdit2;
CEdit *pEdit3;
CDialog::OnInitDialog();
pApp = (CTestFont*) AfxGetApp();
AddFontResource(TEXT("\\FlashDisk\\Startup\\Simsun.ttc"));
if ( pApp->g_Settings.language == LNG_CHINESE ) {
lf.lfHeight = 12;
lf.lfWidth = 0;
memset(&lf, 0, sizeof(LOGFONT)); WCHAR lffn[] = TEXT("Simsun(OpenType)");
wcscpy(lf.lfFaceName,lffn);
lf.lfCharSet = GB2312_CHARSET;
pFontNew->CreateFontIndirect(&lf);
pEdit1 = (CEdit *) GetDlgItem( IDC_INFO_PL );
pEdit2 = (CEdit *) GetDlgItem( IDC_INFO_PRESS );
pEdit3 = (CEdit *) GetDlgItem( IDC_INFO_TOP );
pEdit1->SetFont(pFontNew);
pEdit2->SetFont(pFontNew);
pEdit3->SetFont(pFontNew);
}
return TRUE;
}
but once I added the if ( pApp->g_Settings.language == LNG_CHINESE ) { ... } block,
the screen become black, nothing be displayed.
modified 19-Mar-14 18:54pm.
|
|
|
|
|
|
Hello Audio/Video gurus. I have managed to render a local .mp4 file using Source Reader . I pass the path of the local file in the funtion MFCreateSourceReaderFromURL .
I tried to do the same for rendering a camera on my LAN and passed it's URL into the said function. But it gives error. Error code is 0xc00d36c4 . Watching this error's description, it says that byte stream of the given URL is unsupported.
Question is: DO I have to write my own media source or something to get RTSP packets or this could be done by playing with Source Reader 's properties/attributes? Thanks for your input.
NOTE: I have not tried to interact with or modify any networking related property of Source Reader other than passing this camera URL.
modified 19-Mar-14 7:58am.
|
|
|
|
|
I need a device built for a school project. The device will play a simple game, something like who wants to be a millionaire, and be built solely for that purpose. The game questions needs to be updatable from point to point. Something as small as the nokia 101 would be perfect. I guess the program can be written in C, C++ or the likes and I'm pretty sure I can handle that bit, what I really need help with is the device building. I'm clueless there. Any help would be appreciated.
|
|
|
|
|
Do you really think an answer to a question of this magnitude can be provided in such a forum?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Personally, I'd go with the Arduino platform.
You can buy an Arduino Pro Mini (clone) for about $4 on flea-bay, which you could either couple with a 16x2 character display complete with buttons, or with a 128x160 16-bit graphics display and some extra buttons.
In either case, you should be able to build the device for under $15.
Arduino gives you the advantage of writing in C/C++. The Nokia 101 looks like programming would be something more of a task.
Links:
Arduino Pro Mini - $4.49 delivered to Aus[^]
1602 character display (no buttons) - $2.55 delivered to aus[^]
1602 5 button arduino shield - $5.89 delivered to aus[^]
128x160px tft display (no buttons) - $5.32 delivered to aus[^]
You'd also need a USB->serial converter, which can be bought for a few dollars or so, depending on whether you'd like it to have the ability to auto-reset the arduino at the start of the programming process. If you don't employ that functionality, you need to manually press the reset button at the right time to upload the program to the device. I have one of the 6-wire, auto-reset type. They're often 3-4 times as expensive as a 'cheapy' (but much more convenient)
5 wire usb->serial converter (no auto-reset) - $1.87 delivered to aus[^]
You'd also need a bread-board and some wires, or a soldering iron and some wires.
The neat thing about the tft display, is that it even has an SD card reader on the back. You could easily put the questions on the sd-card and read them from your program. This way, you'd only need to program the device once, updating the questions by simply copying the required data onto the sd-card.
All that said, the memory available on these devices is limited - 2kb of ram, 32kb of program memory and 1kb of eeprom. This should be ample for a Who Wants to Be A Millionaire type game, but it does require a close-eye on your memory usage.
Generating and saving to sdcard BMP or WAV files of several 100kb is reasonably easy, displaying 128x160 bmp files on the tft is trivial.
Sounds like a fun project.
|
|
|
|
|
ex- if( 0 < -1 )
I remember "C" compiler takes bits data of -1 to signed format and returns true for the above statement.
Whats behavior in C++. Is the behavior same/different.Any updated standard(C/C++) brought changes to this behavior.Please answer.
|
|
|
|
|
In C a zero value is assigned to (0 < -1) expression, hence, in the following code
if ( 0 < -1)
{
k = 5;
}
else
{
k = 10;
}
the statement k = 10; is executed.
In C++ the esame expression is evaluated as false and (like happened in the C program) the statement k = 10; is executed.
Veni, vidi, vici.
modified 20-Mar-14 4:16am.
|
|
|
|
|
I tried on gcc compiler, the statement 0 < -1 always false.please help.
|
|
|
|
|