|
from msdn:
CString GetItemText(int nItem, int nSubItem );
Parameters:
nItem - The index of the item whose text is to be retrieved.
nSubItem - Specifies the subitem whose text is to be retrieved.
ex: CString strTemp = m_lbMyListBox.GetItemText(0,0);
-dz
|
|
|
|
|
Oops! I missed that somehow! Thanks,
ns
|
|
|
|
|
I have an .exe File and need to display the version as the title of the Dialog Application . Is there a way I can grab this information and Display it ?
Please Help
|
|
|
|
|
BOOL CMyApp::GetCurrentFileVersionParts(int &a, int &b, int &c, int &d)
{
TCHAR buf[1024];
GetModuleFileName( NULL, buf, sizeof( buf ) );
char version[512];
VS_FIXEDFILEINFO *outputversion;
BOOL ret = GetFileVersionInfo( buf, 0, sizeof( version ), version );
UINT szLen;
ret = VerQueryValue( version, _T("\\"), (void**)&outputversion, &szLen ) ;
if( !ret )
return FALSE;
a = HIWORD( outputversion->dwFileVersionMS );
b = LOWORD( outputversion->dwFileVersionMS );
c = HIWORD( outputversion->dwFileVersionLS );
d = LOWORD( outputversion->dwFileVersionLS );
return TRUE;
}
Dave
|
|
|
|
|
I have a CTreeCtrl who has a message handler for TVN_SELCHANGED
ON_NOTIFY(TVN_SELCHANGED, IDC_MYTREE, OnTvnSelchangedMyTree) this function looks like this:
void CMyApp::OnTvnSelchangedMyTree(NMHDR *pNMHDR, LRESULT *pResult)
{
TRACE("CMyApp::OnTvnSelchangedMyTree()\n");
LPNMTREEVIEW pNMTreeView = reinterpret_cast<LPNMTREEVIEW>(pNMHDR);
UpdateStatusPane();
*pResult = 0;
}
my problem is that when I populate the list it calls this OnTvnSelchangedMyTree() after every item that is added to the list.. my UpdateStatusPane() is a little lengthy, so it makes the populating of my tree slow..
is there any way to add items to a tree without sending a selection changed message after each one added? anyone have any other suggestions?
thanks in advance!
-dz
|
|
|
|
|
Did you try to remove TVS_SHOWSELALWAYS style with ModifyStyle(...) ?
I was not sure what you were doing inside of UpdateStatusPane() , are you changing the tree selection again? If so, then you shouldn't!
VOTD: 23 "And this is his command: to believe in the name of his Son,
Jesus Christ, and to love one another as he commanded us." - 1 John 3:23 (NIV)
|
|
|
|
|
i turned the always show selection off and it still calls the selection changed event handler.. ah well..
i fixed it by adding this:
if (pNMTreeView->action != TVC_UNKNOWN)
UpdateStatusPane();
my UpdateStatusPane() is just populating a side view with a bunch of info about whats selected.. the if statement i added makes it where it wont call the function unless the user selects the item with the keyboard or mouse, not if it is told the selection changed by another function.
-dz
|
|
|
|
|
I'm not sure if this will help but try calling SetRedraw( FALSE ) before any updates and SetRedraw( TRUE ) when you're done.
Joel Lucsy (jjlucsy@ameritech.net)
|
|
|
|
|
wow, that got rid of all of my flickering! thanks a ton!
-dz
|
|
|
|
|
I would like to know how to add a hyperlink to a Dialod window.
Thanks
|
|
|
|
|
void CDZApp::OnLinkButtonClicked()
{ ShellExecute(NULL, _T("open"), "http://www.dzgraphics.com/", NULL,NULL, SW_SHOW); }
that would be the code for a button.. i havent used any hyperlink controls that underline, or make the link blue or anything.. try searching here on CP..
-dz
|
|
|
|
|
http://www.codeproject.com/miscctrl/hyperlink.asp
ur welcome!
Papa
Murex Co.
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
|
Recently in my dealings with Winsock, I have noticed that Windows CE implementation of Winsock seems to be more robust than the Win32 version.
Window CE supports SSL version 2 and 3 simply by calling a couple of additional functions.
Why does the Win32 version of Winsock not support this feature, and is there something similar I am missing on the straight Win32 platform?
This seems incredibly silly that MS would implement such a great feature on JUST the CE platform?
. djrisc .
|
|
|
|
|
I inherited from CWnd and I want that my wnd wont have a taskbar icon.
It's created by CreateEx(), Style - WS_POPUP.
I know bout' the article discussing removing TB-icon in CDialog base appz.
This does'nt work in my case;
HEEEELLLLPPPP!!!!!
--BlackSmith--
"With the help of all mighty", 2001, Me.
|
|
|
|
|
I have a problem with my app when displaying a MessageBox to indicate an error. I display the message box in a losingFocus callback, if the value of a dialog field is out of range. Most times the message box behaves correctly. The problem occurs when the user clicks in a window outside the application, the message box gets displayed and keeps reappearing when the OK button is pressed. This will continue for 10-20 times before the dialog will stop appearing. I have tried all three of the modality values (MB_APPLMODAL, MB_SYSTEMMODAL, MB_TASKMODAL) with the same results.
Any suggestions as to how I can make the messagebox behave properly when the user clicks outside my application?
Thanks in advance,
Bob
|
|
|
|
|
Could you post that part of the code please?
Mustafa Demirhan
http://www.macroangel.com
Sonork ID 100.9935:zoltrix
<nobr>They say I'm lazy but it takes all my time
|
|
|
|
|
I think I need to determine if the focus is going to a window outside my app. How do I do that?
Here is the code.
void DataImportDlg2::OnKillfocusProtocolNameCb()
{
CString protoName;
m_protocolNameCB.GetWindowText(protoName);
if (protoName.GetLength() > 0)
{
int index = m_protocolNameCB.FindStringExact(0, protoName);
if (index == CB_ERR)
{
MessageBox (_T ("Protocol does not exist, to create it, use the Create Protocol button"),
_T ("Data Import"),
MB_ICONERROR | MB_OK | MB_APPLMODAL | MB_TOPMOST);
m_protocolNameCB.SetFocus();
}
Thanks,
Bob
|
|
|
|
|
I am trying to determine if the control that focus is going to next is on my app's window. Here is how I am attempting to do this
void DataImportDlg2::OnKillfocusProtocolNameCb(CWnd* pNewWnd )
{
CString protoName;
CWnd *pMainWnd = (CWnd *) AfxGetMainWnd();
BOOL child = pMainWnd->IsChild(pNewWnd);
When I click on a control on my apps window, the IsChild returns FALSE. I would expect it to return TRUE.
What am I doing wrong?
Thanks in advance,
Bob
|
|
|
|
|
Well, this won't work because the control is the child of your View class; not the CMainFrame class.
I have two suggestions: The first one is the easier way: Don't try to validate the data everytime you loose focus. Instead, validate it when the user clicks on OK button.
If you want to do it whenever the window looses focus do it this way: Create a bool variable as a member of your view. Lets say m_bChildHasFocus
Now, whenever the control gets the focus set the variable to true and whenever it looses set it false. Here is the code:
void DataImportDlg2::OnKillfocusProtocolNameCb()
{
if (!m_bChildHasFocus)
return CView::OnKillFocus();
m_bChildHasFocus = false;
CString protoName;
m_protocolNameCB.GetWindowText(protoName);
if (protoName.GetLength() > 0)
{
int index = m_protocolNameCB.FindStringExact(0, protoName);
if (index == CB_ERR)
{
MessageBox (_T ("Protocol does not exist, to create it, use the Create Protocol button"),
_T ("Data Import"),
MB_ICONERROR | MB_OK | MB_APPLMODAL | MB_TOPMOST);
m_protocolNameCB.SetFocus();
m_bChildHasFocus = true;
}
Also, don't forget to add the OnGetFocus function. In OnGetFocus functions, just set m_bChildHasFocus = true .
Mustafa Demirhan
http://www.macroangel.com
Sonork ID 100.9935:zoltrix
<nobr>They say I'm lazy but it takes all my time
|
|
|
|
|
Hi
I would need your help, I need to add text in my multiline EditBox when a user clicks on the appropriate link on the menu.
I use a Dialog-based Application.
Thanks for helping me!
|
|
|
|
|
CEdit* pEdit = (CEdit *) GetDlgItem (IDC_MyEdit);
ASSERT (pEdit != NULL);
CString strText;
pEdit->GetWindowText (strText);
strText += "Added text";
pEdit->SetWindowText (strText);
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
CString szContent = "...";
myeditbox.SetSel(0,-1); // Ctrl-A
myeditbox.ReplaceSel( szContent.GetBuffer(0) ); // Paste
And I swallow a small raisin.
|
|
|
|
|
Sorry but I'm working on a HTML Editor and your both methods works, but not for the type of project I'm working on.
I want to add text at my cursor's position in my edit box, and someone told me I had to use ReplaceSel.
Anyways, please tell me what I have to do.
Thanks a lot!
|
|
|
|
|
This is what MSDN says on recv
If the socket is connection oriented and the remote side has shut down the connection gracefully, and all data has been received, a recv will complete immediately with zero bytes received. If the connection has been reset, a recv will fail with the error WSAECONNRESET.
and then
If no error occurs, recv returns the number of bytes received. If the connection has been gracefully closed, the return value is zero. Otherwise, a value of SOCKET_ERROR is returned, and a specific error code can be retrieved by calling WSAGetLastError.
The first paragraphs says if all data has been received. Is there ever a case where recv returns 0 for a few cycles but then continues receiving data or does 0 mean dead?
Todd Smith
|
|
|
|