|
|
Create some resource DLL's (dll that contains only resources without a code) for different languages. Type in CYourApp::InitInstance :
hI=LoadLibrary(....)
AfxSetResourceHandle(hI);
unfortunately switching of language on the fly without application reboot is difficult task since you must recreate all objects (menus, toolbars, dialogs and so on)
|
|
|
|
|
thanks i`ll try that, and what can you suggest me to change them on the fly?
|
|
|
|
|
I can't offer anything more cleverly as something like that example:
for(int i = 0; i < m_arrToolbars.GetSize(); i++) <br />
{ <br />
pToolbar = (CToolBar*)m_arrToolbars[i]; <br />
pToolbar->DestroyWindow(); <br />
delete pToolbar; <br />
}: <br />
<br />
... <br />
<br />
for(i = 0; i < m_arrToolbarIDs.GetSize(); i++) <br />
{ <br />
UINT nID = (UINT)m_arrToolbarIDs[i]; <br />
pToolbar = new CToolBar(); <br />
if (!pToolbar->CreateEx(m_pMainFrame, TBSTYLE_FLAT, WS_CHILD | <br />
CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, <br />
CRect(1,1,1,1), AFX_IDW_TOOLBAR + nID) || <br />
!pToolbar->LoadToolBar(nID)) <br />
{ <br />
TRACE(_T("Failed to create view's toolbar from Resource %d\n"), nID); <br />
delete pToolbar; <br />
continue;
} <br />
ASSERT(::IsWindow(pToolbar->GetSafeHwnd())); <br />
<br />
CString csTitle; <br />
csTitle.LoadString(m_arrToolbarTitleIDs[i]); <br />
pToolbar->SetWindowText(csTitle); <br />
<br />
m_arrToolbars.Add(pToolbar); <br />
}
But it's a very little part of changing interface - only for toolbars. Similarly you should execute such operation for all objects including all dialogs. However why you should make the complications to yourself? It is easier to reboot application
|
|
|
|
|
I need to address the Serial (COM1) port on NT kernel based systems (NT4 and Win2k). I read the articles in the system section, but they don't seem to cover what I'm looking for.
As I want to address some hardware I made myself, I need to have full control. I.E: I must be able to put DTR on high or low at will. The articles here assume baut-rate based comminucations are the way to go.
I'd rather not use the DDK, I don't even have it.
Suggestions? Ideas?
I'm thinking about using the MSCOMM32 ActiveX control, but I'm not too happy with it. I've been looking into ::CreateFile. I can open the com port without trouble, but there isn't functionality for directly reading and writing to the port.
Please help me out,
thanks in advance and kind regards,
Griffith
Everything you say will be misquoted, ripped out of context and used against you.
|
|
|
|
|
After you've opened the port with ::CreateFile you can use ::WriteFile to write to the port. Use ::SetCommState to control the DTR/RTS lines, the baud rate and parity settings via the DCB structure.
If a train station is where the train stops, what's a workstation...?
|
|
|
|
|
Thanks a lot!
Everything you say will be misquoted, ripped out of context and used against you.
|
|
|
|
|
I having trouble get any items to show in my CListView, I first tried this, from examples I found:
<br />
LV_ITEM lvi;<br />
lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM; <br />
lvi.iItem = index; <br />
lvi.iSubItem = 0; <br />
lvi.iImage = 0;<br />
lvi.pszText = LPSTR_TEXTCALLBACK; <br />
lvi.lParam = (LPARAM) pItem;<br />
<br />
if (GetListCtrl().InsertItem(&lvi) == -1)<br />
return FALSE;<br />
where pItem is a struct holding info about each item, e.g. all the text for each column(i'm using report view).and I message maped ON_NOTIFY_REFLECT(LVN_GETDISPINFO, OnGetDispInfo) and had this code to set all the column text:
<br />
void CTest::OnGetDispInfo(NMHDR* pNMHDR, LRESULT* pResult) <br />
{<br />
LV_DISPINFO* pDispInfo = (LV_DISPINFO*) pNMHDR;<br />
if (pDispInfo->item.mask & LVIF_TEXT) {<br />
ITEMINFO* pItem = (ITEMINFO*) pDispInfo->item.lParam;<br />
switch (pDispInfo->item.iSubItem) {<br />
case 0:
::lstrcpy(pDispInfo->item.pszText, pItem->date);<br />
break;<br />
case 1:
::lstrcpy(pDispInfo->item.pszText, pItem->name);<br />
break;<br />
case 2:
::lstrcpy(pDispInfo->item.pszText, pItem->size);<br />
break;<br />
}<br />
}<br />
*pResult = 0;<br />
}<br />
Which was pretty much from an example as well, which should set thetext for each column, my problem is nothing shows up the scrollbar apears so items are getting added but no text shows. I then tried just using GetListCtrl().InsertItem(index, "") and then use GetListCtrl().SetItemText(index, subIndex, "sometext") to set each coloumn but still the scrollbar showed but no text.
Has anyone had this problem, or can give me any help, maybe i'm doing something obviously wrong, thanks for any help.
oh sorry about the loss of format.
luke. - hope that all made sense
hmm it said i didnt fill out some fields, but they all are... hope it works this time
|
|
|
|
|
|
I cant find the implementation of say CMemoryException so I can pattern my class after it. THe .cpp files that came up in search of the MFC src folder didnt seem to have this class definition as far as I could see...
Thanks,
ns
|
|
|
|
|
It's in mfc\include - afx.h and afx.inl.
Tomasz Sowinski -- http://www.shooltz.com
*** Vodka. Connecting people. ***
|
|
|
|
|
How do you open an inl file? Doesnt open in Vstudio...
afx.h has the class definition, definitely useful. Now i need to find the body of the class...maybe its in the inl?
Thanks,
ns
|
|
|
|
|
ns wrote:
How do you open an inl file? Doesnt open in Vstudio...
Geez - did you parachuted from VB recently?
Just drag'n'drop the file or use File|Open.
Tomasz Sowinski -- http://www.shooltz.com
*** Vodka. Connecting people. ***
|
|
|
|
|
Thanks - but I stil didnt find the body of the functions.
and no, I am not too familiar with either VB or VC, (but want to be)
Thanks,
ns
|
|
|
|
|
Try to use Find in Files. Search in mfc\include and use CMemoryException:: (with two semicolons) as search string.
Tomasz Sowinski -- http://www.shooltz.com
*** Vodka. Connecting people. ***
|
|
|
|
|
derive from it and add ur own custom data if u want
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
I use VC++'s online help for summary information about classes and APIs. However, if you want to ensure you have the latest and greatest docs (my installed online help is pretty old), see this MSDN link[^].
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
hi,
if i start my mdi vc++ programm, the mdi is not as big as it could. is there a possibility how my mdi programm could be as big as it could, anytime when i start the programm?
sunny
|
|
|
|
|
In the OnInitInstance method of your application,
replace
m_pMainWnd->ShowWindow(m_nCmdShow);
by
m_pMainWnd->ShowWindow(SW_SHOWMAXIMIZED);
HTH,
So I came to find
To end up this way
Feeling like I'm God
Feeling there's no way
KoRn, "No Way"
|
|
|
|
|
Good for p0rn sites.
if you start putting in too manay features, it no longer remains useful for beginners
quote in a CP article comment, shiraz baig
|
|
|
|
|
ShowWindow ( SW_MAXIMIZE );
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Replace m_nCmdShow with SW_SHOWMAXIMIZED in the call to ShowWindow inside CYourApp::InitInstance.
Tomasz Sowinski -- http://www.shooltz.com
*** Vodka. Connecting people. ***
|
|
|
|
|
I developed a COM project in VC++ 6.0 and it runs successfully. But now when i try to compile it on VC++ 7.0, the compiler is giving me strange error. Where ever there is a statement like a=22 or name = "abc", the error is reported that the symbol "=" is ambiguous. Can any one tell me whats the problem
|
|
|
|
|
i think it means that "=" has 2 functions in vc7. i only use vc6 so cant test it, but ambiguous means "two meanings" so my theory is that "=" can do 2 things and the compiler isnt sure what you want it to do...i wouls suggest looking it up in msdn if you have it, or if not, its at www.msdn.microsoft.com and get to the msdn libray from there to look it up.
Hope this helps,
Sas
|
|
|
|
|
try to typecast the value you want to assign. Sometimes a number can be of several types (int/long/...) and all those are overloaded. So you have to explicit tell the compiler which conversion to use.
e.g. if your variable a has an overloaded operator= which takes a right hand
type of int and another which takes a long, then you would have to write either a=(int)22; or a=(long)22;
Sure, it won't complain about ints and longs (internal conversion), but other types may need explicit type conversion (strings e.g. can be of many different types: unicode, utf8, chars, BSTR, ...)
|
|
|
|