|
Shouldn't it be created using the WS_CHILD style? All the controls are supposted to be child windows. Just an idea.
Cheers
Steen.
"To claim that computer games influence children is ridiculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
Well, I tried to OR inot the style WS_CHILD and it did not help....
Thank you...
|
|
|
|
|
How about message reflection? I can't remember if it's nescessary to make the control work properly.
Cheers
Steen.
"To claim that computer games influence children is ridiculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
what is message reflection ?
|
|
|
|
|
Look at TN062 in MSDN.
Sorry for not elaborating, but I really have to get home now (it's almost 5 pm in Denmark).
Cheers
Steen.
"To claim that computer games influence children is ridiculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
I think the style is wrong.
WS_CHILD|WS_VISIBLE| ....
don't WS_OVERLAPPEDWINDOW (WS_CAPTION, WS_SYSMENU, WS_THICKFRAME, WS_MINIMIZEBOX...)
|
|
|
|
|
suggestion
CErrReportListCtrl:public CListCtrl
{
};
CErrReport:public CWnd
{
private:
CErrReportListCtrl m_ListCtrl;
public:
CErrReport(CWnd* pParent,CRect& r=CRect(0,0,200,200))
{
Create(pParent,r);
}
void Create(CWnd* pParent,CRect& r)
{
Create(WS_OVERLAPPED|..,...,r,pParent,..);
m_ListCtrl.Create(WS_CHILD|WS_VISIBLE|..,.....,this,1);
}
void OnSize(nType, cx, cy)
{
//Maybe
if(GetSafeWnd()!=NULL)
m_ListCtrl.MoveWindow (0, 0, cx, cy);
}
};
CErrReport *p= new CErrReport(this);
The Listctrl is nested in the CWnd
|
|
|
|
|
I will try this one, it looks like it's going to work. I found a similar solution in a book but it was too complicated, yours looks better.
Thank you.
Shay
|
|
|
|
|
Can someone verify my thinking here - I think that a windows message can only be handled by a window-based class. Is this right?
For example: in a MFC app I can handle a message in the view, mainframe, etc. but I can't handle it directly in a non-window class that the view instantiates. (I know I could always call a function in the other class from the view's handler.)
thanks
|
|
|
|
|
Yes, this is true. The exception is WM_COMMAND, which can be handled by CCmdTarget derived classes, like CDocument, CWinApp or CYourOwnCmdTarget.
Tomasz Sowinski -- http://www.shooltz.com
Never argue with an idiot, he'll bring you to his level and beat you with experience.
|
|
|
|
|
Thanks, Tomasz. I thought that was right, but sometimes it helps if you can find someone else that agrees.
|
|
|
|
|
If you really need to provide message handling stuff in classes not derived from CWnd, you may want to use CSubclassWnd by Paul DiLascia (the guy who writes C++ QA column in MSDN Magazine). Just search for CSubclassWnd in MSDN.
Tomasz Sowinski -- http://www.shooltz.com
Never argue with an idiot, he'll bring you to his level and beat you with experience.
|
|
|
|
|
Dear all,
I created a subfolder1 under a shared folder1 which was shared to all users
exp: \\server1\shared folder1\shared subfolder1\
then i need to shared this subfolder1 to a specific user, so i need the local path of this subfolder1 to implement network share
how can i get local path from \\server1\shared folder1??
Thanks for your help.
Tida
|
|
|
|
|
You can use NetShareGetInfo
If you're running on Windows NT/2K/XP you can use level 2 and a structure of type SHARE_INFO_2;
on Windows 9x/ME level 50 and pass in a structure of type share_info_50.
The two structures unfortunately are defined in two different header files and, if you're targeting win9x you'll also need to link to a different library (netapi32.lib for NT/2K/XP and svrapi.lib for 9x)
Hope that helps,
Alberto
|
|
|
|
|
How do I compile Visual C++ .NET projects using the .vcproj file from the command line?
Thanks,
James
|
|
|
|
|
<disclaimer>I've not tried this with VS.NET, just VS6 where it worked a treat</disclaimer>
1. In a command prompt window, execute the vcvars.bat file in the Visual Studio .NET folder\VC7\bin folder. (i.e. Set up environment variables etc)
2. Try the command devenv /build .vcproj filename . If you do devenv /? , it shows you the command line parameters.
Stuart Dootson
'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
|
|
|
|
|
Hi all,
Does anyone know if it is possible, when dialling up the internet with a modem, to run local applications using the login script (the one typically used to provide information to the ISP) so that, when the system dials, an application runs - instaed of having a system that polls the port to see if there's a connection.
Thanks,
Alberto Giannetto
|
|
|
|
|
I am repeatedly accessing this function in my database app:
void CTrain1View::GetPhotoDB(CString m_PhotoDBName,CString m_MineName)
{
if (m_photoDb.IsOpen()) m_photoDb.Close();
m_photoDb.OpenPhotoDb(m_PhotoDBName, m_MineName);
}
where
int DbClass::OpenPhotoDb(CString PhotoDBName, CString MineName)
{
try
{
if (FAILED (m_pConnPhoto->Open (_bstr_t ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source = "+ PhotoDBName ),_bstr_t (""), _bstr_t (""), adModeUnknown)))
{
AfxMessageBox ("Can't open datasource");
return -1;
}
CString partQuery = "'"+MineName+"'";
CString SQLQ = "SELECT * FROM tblMine WHERE (DefID = "+partQuery+")";
char* SQLQuery = new char [SQLQ.GetLength()+1];
strcpy(SQLQuery, SQLQ);
m_pCommandPhoto->ActiveConnection = m_pConnPhoto;
m_pCommandPhoto->CommandText= SQLQuery;
m_pRecordsetPhoto->CursorLocation = adUseClient;
m_pRecordsetPhoto->Open ((IDispatch *) m_pCommandPhoto, vtMissing, adOpenKeyset,
adLockOptimistic, -1);
delete[] SQLQuery;
return num;
}
catch(_com_error)
{
PrintProviderError(m_pConn);
}
}
The second time I call the first function, and it calls OpenPhotoDB, there is a com error at:
if (FAILED (m_pConnPhoto->Open (_bstr_t ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source = "+ PhotoDBName ),_bstr_t (""), _bstr_t (""), adModeUnknown)))
{
AfxMessageBox ("Can't open datasource");
return -1;
}
even though as you can see, I did close the db before trying to open it again. Any one know ADO to help me out. I'm opening and then closing it before trying to open it again, so why does it choke?
Thanks,
ns
|
|
|
|
|
First of all why are you closing the database connection prior to each query? This is a very inefficient way for your code to work. It should be more like if db.closed thhen db.open(). You should use the open database connection to execute as many queries you want.
This will not solve your current problem but will make your code more efficient, unless I missed something while reading your message.
|
|
|
|
|
Okay - so I should open the database just once and perform as many queries as Ilike on it. Right?
The reason I want to close and reopen is that most of the time its the same db, but sometimes the a different db name to open might come in as a parameter.
What about the recordset object. Since I do rs.Open for each query, should I close it each time and reopen it I pass it a new SQL string?
Thanks
ns
|
|
|
|
|
None of the messsageboxes fire, the program execution merrily skips past the called function and goes on!
THe error checking in place is:
void PrintProviderError(_ConnectionPtr pConnection)
{
HRESULT hr = S_OK;
_bstr_t strError;
ErrorPtr pErr = NULL;
try
{
long nCount = pConnection->Errors->Count;
for(long i = 0; i < nCount; i++)
{
pErr = pConnection->Errors->GetItem(i);
CString temp;
temp.Format("Error #%d\n", pErr->Number);
AfxMessageBox(temp);
temp.Format(" %s\n",(LPCSTR)pErr->Description);
AfxMessageBox(temp);
temp.Format(" (Source: %s)\n",(LPCSTR)pErr->Source);
AfxMessageBox(temp);
temp.Format(" (SQL State: %s)\n",(LPCSTR)pErr->SQLState);
AfxMessageBox(temp);
temp.Format(" (NativeError: %d)\n",(LPCSTR)pErr->NativeError);
AfxMessageBox(temp);
if ((LPCSTR)pErr->GetHelpFile() == NULL)
{
AfxMessageBox("\tNo Help file available\n");
}
else
{
CString temp1;
temp1.Format("\t(HelpFile: %s\n)" ,pErr->HelpFile);
AfxMessageBox(temp1);
temp1.Format("\t(HelpContext: %s\n)" , pErr->HelpContext);
AfxMessageBox(temp1);
}
}
}
catch(_com_error &e)
{
PrintComError(e);
}
}
void PrintComError(_com_error &e)
{
_bstr_t bstrSource(e.Source());
_bstr_t bstrDescription(e.Description());
AfxMessageBox("Error\n");
CString temp;
temp.Format("\tCode = %08lx\n", e.Error());
AfxMessageBox(temp);
temp.Format("\tCode meaning = %s", e.ErrorMessage());
AfxMessageBox(temp);
temp.Format("\tSource = %s\n", (LPCSTR) bstrSource);
AfxMessageBox(temp);
temp.Format("\tDescription = %s\n", (LPCSTR) bstrDescription);
AfxMessageBox(temp);
}
|
|
|
|
|
Dear all,
I need to set quota limit for users on a shared folder on a file server.
How to implemented it in VC++? Is there a API function?
Thanks
|
|
|
|
|
Hi everyone,
I did not know where else to pose this question. So, here goes. If this is not the right place, please ignore it. Though, I would really appreciate some suggestions as to where to look.
I want to add an entry to the context menu of Windows explorer. Specifically, everytime someone right clicks on an XML file, I want to show a menu item which runs a python program. So I created the following registry entry file.
REGEDIT4
[HKEY_CLASSES_ROOT\.xml]
@="XMLfile"
[HKEY_CLASSES_ROOT\xmlfile]
@=""
[HKEY_CLASSES_ROOT\xmlfile\shell\Open with Something\command]
@="C:\\Python22\\wxPython\\tools\\boa\\boa.pyc"
This works fine, for any .EXE file. However, whenever I try to launch a python file, it does not work. It says [The XML file name] is not a valid Win32 document.
However, double clicking on boa.pyc runs it just fine. So, I do not know why it does not launch it.
Any suggestions or some registry scripts are welcome!
Pankaj
Without struggle, there is no progress
|
|
|
|
|
a .pyc file still runs through the python exe. try changing:-
[HKEY_CLASSES_ROOT\xmlfile\shell\Open with Something\command]
@="C:\PATH\TO\PYTHON\PYTHON.EXE C:\\Python22\\wxPython\\tools\\boa\\boa.pyc"
STL is a religeon. Enquiries to Reverend Christian Graus
|
|
|
|
|
how can i put with Create function a working button on a Child Window of my mdi app derived from CFormView ?
<< Thank you people >>
|
|
|
|