|
1) You should in any case learn to add and remove your own member variables. The wizard blows up from time to time, and if that is when you start trying to learn how to do things by hand, you'll be stuffed.
2) UpdateData is a screwy mechanism, as has been said. Do not use it.
Christian
We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )
|
|
|
|
|
I already fluent in C++ so manually adding and removing member variables is no problem, I was just looking for a more elegant solution.
I will definately heed the warning about avoiding UpdataData.
I think what happens with serialized API is all the bad design choices get propagated from one version to the next.
|
|
|
|
|
Any one know how to get to the "variables tab" in VC 7.
The class wizard has gone missing and I want to be able to quickly delete (or better yet rename) misspelled variable without mucking with the source code.
|
|
|
|
|
I have a tab control in a CView. If I want to use/display a CListCtrl on each tab of the control, do I need multiple instances of the CListCtrl or would it be better to just create one instance of the CListCtrl and repopulate the cells with new data when each tab is made active?
Also, I am updating statistics I receive from the network for each tab. I think since the gathering of the statistics from the network will be in separate worker threads, that I will use another thread to copy data from the global stats array into the CListCtrl periodically. Would it be beneficial to not update the CListCtrl until it is displayed (e.g. the tab for that control became active) or just go ahead an update it though it is not being displayed?
Any comments or suggestions would be appreciated. TIA
|
|
|
|
|
In a Tab Control you put different data in each index (one dialog per index). Then, you must put another instance (in another dialog) of the ListControl.
About the updating of data, you can do everything once. I think is better because you don't need to wait for update always you became a tab index active.
[]'s
Cristiano.
|
|
|
|
|
Cris wrote:
In a Tab Control you put different data in each index (one dialog per index). Then, you must put another instance (in another dialog) of the ListControl.
Cris, Thanks for your reply. Are you saying that I must have an instance for each tab? Meaning if I have 3 tabs I have 3 ListControl instances, 1 for each tab? If I don't write to the List Control until the tab is updated, then couldn't I just use one instance of the ListControl and clear its contents and fill it with the data that pertains to the active tab when it is activated?
|
|
|
|
|
JohnnyG,
You can do this. But, the tab control concept is the fact that use different type of controls in differents tabs (Example: TAB1, one ListControl; TAB2, one ComboBox and one EditBox; TAB3, two ListControls). Now you don't need do like this, but tomorrow I can do.
[]'s
Cristiano.
|
|
|
|
|
I'm trying to subclass a CFileDialog window. I have all the functions and the notifications to see what's happening, but I can't find the way to update the dialog, like with UpdateData(0). Any suggestions ?
|
|
|
|
|
CFileDialog is derived from CCommonDialog which is derived from CDialog which is derived from CWnd which has an UpdateData method. So you should be able to call UpdateData from your CFileDialog derived class. Or am I missing something here?
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
I have a regular dll that is an "app modless dialog based", and there is only one exported function that call the dialog.
If I end the dll in run time mode with FreeLibrary function, the dll ends corretly. But if I end in load time simply closing the dialog, no event occur and the dll is not ended corretly. How solve this problem ?
Thanks,
Cristiano.
|
|
|
|
|
You will always have to explicitly unload the DLL with FreeLibary or wait till this happens automatically when the main program ends. There's no way for the DLL to "kill" itself.
What you mean by "the dll is not ended correctly"?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
"the dll is not ended corretly" means: the dll project on VC6 don't send a event (OnClose, OnDestroy, PostNcDestroy or the class destructor) when the dialog end.
|
|
|
|
|
I am developing an application that resides solely in the tray as an icon.
I have created a menu resource call IDR_TRAY_MENU that is the menu a user will see when they right-click on the tray icon.
One of the static labels/options (ID_TRAY_LOGIN) on the menu is "Login...". When selected, my code responds to this command by launching a login window, etc.
Upon successful login, I have code that is *supposed* to modify the text label of the login menu item to "Logout".
I am using the following code to attempt this:
//////// Start Code ////////
CMenu *menu = GetMenu();<br />
CMenu *submenu = menu->GetSubMenu(0);<br />
<br />
submenu->ModifyMenu(ID_TRAY_LOGIN, MF_BYCOMMAND|MF_STRING, ID_TRAY_LOGIN, "&Logout");<br />
DrawMenuBar();
//////// End Code ////////
The code executes without problems. When I check the text of the item (using GetMenuString) after ModifyMenu, it *is* the correct text ("Logout"). But, the menu does not change the next time the user clicks on the tray icon.
I have attempted to create a new menu item using AppendMenu and InsertMenu just to see if it was something I was doing. But, those calls did not modify the viewable menu, although the items *were* added (upon checking the item text).
Does anyone have a suggestion for me?
Thanks in advance for your help.
Thanks,
Jeff Elmore
|
|
|
|
|
i think you have to trap the ON_COMMAND_UPDATE_UI message and change the text there ... like maybe have the reqd text as a variable somwhere and change when reqd so that the updateui thing reads out the correct text for the menu
we just have both and disable the login when they're logged in ... less confusing for the users
"... and so i said to him ... if it don't dance (or code) and you can't eat it either f**k it or throw it away" sonork: 100.18128 8028finder.com
|
|
|
|
|
Thanks for the info, Lauren. I have tried that too. Forgot to mention. I have also tried to just disable the menu item, but it won't. Uggh.
Thanks,
Jeff Elmore
|
|
|
|
|
hi again jeff
the code we use is as follows:
void CMainFrame::OnUpdateSignOut(CCmdUI* pCmdUI)
{
CMyApp *pApp = (CMyApp*)AfxGetApp();
if (!pApp->bSignedIn)
pCmdUI->Enable(FALSE);
}
we use a app level variable for the signed in status ... true = signed in ... false not ... this code works in ours
"... and so i said to him ... if it don't dance (or code) and you can't eat it either f**k it or throw it away" sonork: 100.18128 8028finder.com
|
|
|
|
|
I am using CFTPConnection to upload some text files to a FTP server. If the server ignores case in it's directory path then all works well when I use SetCurrentDirectory() and call PutFile() , but when the server is case sensitive then SetCurrentDirectory() fails and all the files are uploaded on the root. I have debugged trough the steps and the string that is being passed into SetCurrentDirectory() is the correct string (with the appropiate capital letters).
Has anyone seen this? Or am doing this all wrong and should use a different set of functions?
Also SetCurrentDirectory() also fails when there are periods(.) in a directory name.
Thanks in advance for the help.
***********************
Tony Fontenot
Recreational Solutions
tony@recsolutions.com
***********************
|
|
|
|
|
I'm frensh, so take no care about how i write this message....
I want to put in the windows spool a printable file. I know some API like GetJob, EnumPrinters and so on... but i don't know how to use those
So if some peaple knows, it will be pretty cool to give me a solution !
Thanks,
March'
And remember, I'm frensh... and my English level is not very high
See you later on the Web !
|
|
|
|
|
As you know, i'm looking for how to use EnumPrinters...
Well, i know now how to get all printers on the network !
I give you my solution !
So COOL ! No?!
<br />
DWORD dwNeeded = 0;<br />
DWORD dwReturned = 0, i, j, fin1, fin2;<br />
int bFlag;<br />
CString s;<br />
<br />
m_List.ResetContent();<br />
EnumPrinters(PRINTER_ENUM_REMOTE, NULL, 1, NULL, 0, &dwNeeded, &dwReturned);<br />
if (dwNeeded == 0) <br />
AfxMessageBox("Erreur 1 -> size serveur");<br />
else<br />
{<br />
<br />
ppi1 = (PRINTER_INFO_1 *)GlobalAlloc(GPTR, dwNeeded);<br />
if (!ppi1)<br />
AfxMessageBox("Erreur 2 -> alloc serveur");<br />
else<br />
{<br />
bFlag = EnumPrinters(PRINTER_ENUM_REMOTE, NULL, 1, (LPBYTE)ppi1, dwNeeded, &dwNeeded, &dwReturned);<br />
if (!bFlag)<br />
{<br />
AfxMessageBox("Erreur 3 -> info serveur");<br />
}<br />
else<br />
{<br />
fin1 = dwReturned;<br />
for ( i=0 ; i<fin1 ; i++ )<br />
{<br />
s.Format("Nom Serveur: %s", ppi1->pName);<br />
m_List.AddString(s);<br />
s.Format("Description Serveur: %s", ppi1->pDescription);<br />
m_List.AddString(s);<br />
s.Format("Comment Serveur: %s", ppi1->pComment);<br />
m_List.AddString(s);<br />
m_List.AddString("");<br />
bFlag = EnumPrinters(PRINTER_ENUM_NAME, ppi1->pName, 1, NULL, 0, &dwNeeded, &dwReturned);<br />
if (dwNeeded == 0 )<br />
{<br />
AfxMessageBox("Erreur 4 -> size printer");<br />
}<br />
else<br />
{<br />
ppi2 = (PRINTER_INFO_1 *)GlobalAlloc(GPTR, dwNeeded);<br />
if (!ppi2)<br />
AfxMessageBox("Erreur 5 -> alloc printer");<br />
else<br />
{<br />
bFlag = EnumPrinters(PRINTER_ENUM_NAME, ppi1->pName, 1, (LPBYTE)ppi2, dwNeeded, &dwNeeded, &dwReturned);<br />
if (!bFlag)<br />
{<br />
AfxMessageBox("Erreur 6 -> info printer");<br />
}<br />
else<br />
{<br />
fin2 = dwReturned;<br />
for ( j=0 ; j<fin2 ; j++ )<br />
{<br />
s.Format("Nom Printer: %s", (ppi2+j)->pName);<br />
m_List.AddString(s);<br />
s.Format("Description Printer: %s", (ppi2+j)->pDescription);<br />
m_List.AddString(s);<br />
s.Format("Comment Printer: %s", (ppi2+j)->pComment);<br />
m_List.AddString("");<br />
}<br />
}<br />
}<br />
}<br />
m_List.AddString("");<br />
m_List.AddString("");<br />
ppi1 = ppi1 + 1;<br />
}<br />
}<br />
}<br />
}<br />
Now, i want to use AddJob... So if somebody knows something...
You know what you have to do !
See you later on the web !
March'
|
|
|
|
|
I use this code in some IScriptControl :
function f
dim x
'...
x = ob.GetArray ' x is VT_ARRAY | VT_BSTR, ob is ok
msgbox x(0)
end function
The script returns error on calling ExecuteStatement with "f" as parameter. The cause seems to be x(i) . The same code runs ok in a VB project. What's wrong?
rechi
|
|
|
|
|
Hi there,
In first, i want to tell i have not problem in using of TransparentBlt !!!
But i got two results in my running in Win98 and Win NT (2000 and XP).
In Win NT, my program works fine ... without any problem
But in Win98, it is very very bad ...
I don't know what's problem ...
I just want to know, DO YOU HAD PROBLEM LIKE ME ? IN WIN98 ?
What is ur advice ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Instead of using TransparentBlt, use another technique called True Mask Method. The method is as follows,
Make a monochrome mask in which fill white to the portion where you want to hide the source bitmap. Then use BitBlt 3 times as follows:
//1. Invert and draw
BitBlt(dcDest, x, y, W, H, dcSource, x1, y1, SRCINVERT);
//2. AND with the mask
BitBlt(dcDest, x, y, W, H, dcMask, 0, 0, SRCAND);
//3. Invert again to view the final bitmap
BitBlt(dcDest, x, y, W, H, dcSource, x1, y1, SRCINVERT);
Best of luck,
Rejeesh
|
|
|
|
|
I answered this question for you once before (here). Did that answer not help you?
CPUA 0x5041
Sonork 100.11743 Chicken Little
"So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies
Within you lies the power for good - Use it!
|
|
|
|
|
Hi there,
Is there any function for copying all of a vector elements to another vector ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
try std::copy
To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses. /. #3848917
|
|
|
|
|