|
If you're using MFC, use CenterWindow(CWnd::GetDesktopWindow()) in your OnInitDialog() handler.
If you're not using MFC, you'll have to do a MoveWindow() and calculate the position where it should be. Look at the source code for CWnd::CenterWindow() to get an idea on how to do this.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
Dear ALL,
I am developing an application for Windows NT/2000/XP. I need to know the path of root directory in my application.
Is there any API to know the root directory path (ie. c:\winnt or c:\windows)
Thanks in advance.
Rohit
|
|
|
|
|
Try GetWindowsDirectory()
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
|
Hi world,
I want a simple dialog box (like CFileDialog) who let the user choose only a directory (not a file)...
Can somebody give me a simple example which does that?
Thanks in advance...
Hello World!!!
from Raphaël
|
|
|
|
|
|
I would have to look in Code Project first, sorry...
Hello World!!!
from Raphaël
|
|
|
|
|
Don't worry!
|
|
|
|
|
|
The following sample browses for a directory:
void BrowseForDir()<br />
{<br />
char caPathName[MAX_PATH];<br />
<br />
caPathName[0] = 0;<br />
<br />
GetDlgItemText(IDC_MYCTRL_TO_BACKFILL,caPathName,MAX_PATH);<br />
<br />
BROWSEINFO sBI;<br />
memset(&sBI,0,sizeof(BROWSEINFO));<br />
<br />
sBI.hwndOwner = m_hWnd;<br />
sBI.pidlRoot = NULL;<br />
sBI.pszDisplayName = caPathName;<br />
sBI.lpszTitle = "Select the folder that contains the desired files";<br />
sBI.ulFlags = BIF_RETURNONLYFSDIRS;<br />
sBI.lpfn = NULL;<br />
<br />
LPITEMIDLIST pidl = SHBrowseForFolder(&sBI);<br />
if (pidl)<br />
{<br />
SHGetPathFromIDList(pidl,caPathName);<br />
SetDlgItemText(IDC_MYCTRL_TO_BACKFILL,caPathName);<br />
GotoDlgCtrl(GetDlgItem(IDC_MYCTRL_TO_BACKFILL));<br />
}<br />
}
onwards and upwards...
|
|
|
|
|
My application uses a Flexgrid. Iam using the first row as the header. I need to insert new rows (data rows) after the first row (as the second row). Every new row inserted must become the second row and the remaining rows should get pushed down. Resetting the number of rows works but it appends a row at the end of the grid. Is there any way to achieve this? Where can I get the complete documentation on Flexgrid?
thanks.
|
|
|
|
|
void CMSHFlexGrid::AddItem(LPCTSTR Item, const VARIANT& Index) adds a new row. If you want to add a new row after the header then just call:
AddItem( Item, _variant_t((long)1) );
If you want the documentation for FlexGrid, go to Project->Add to project->Components and controls and then find the flexgrid control. Select it and then click More Info.
// Afterall, I realized that even my comment lines have bugs
|
|
|
|
|
is there anyway or API that helps me printing the contents of an List view control ?? , i mean here with "Printing" is to use the printer device not pronting on the screen.
if anyone can support me with articles or code will be better.
i use MFC.
thanx for advance
|
|
|
|
|
I have a stl set with pointers to objects. When I insert() a reference to one of these objects in the empty set I get an access violation in the while loop of the following code:
<br />
void _Dec()<br />
{if (_Color(_Ptr) == _Red<br />
&& _Parent(_Parent(_Ptr)) == _Ptr)<br />
_Ptr = _Right(_Ptr);<br />
else if (_Left(_Ptr) != _Nil)<br />
_Ptr = _Max(_Left(_Ptr));<br />
else<br />
{_Nodeptr _P;<br />
while (_Ptr == _Left(_P = _Parent(_Ptr)))<br />
_Ptr = _P;<br />
_Ptr = _P; }}<br />
When I change the set to a list an push_back() the same object I works fine. Is this an stl bug, or must I be doing something wrong?
|
|
|
|
|
hi, I have the same problem. how to solve this ?
|
|
|
|
|
Where can I get the actual values of the vb constants defined for an activex control which I include in a vc project (for instance vtChChartType2dXY for mschart) ?
Thanks
|
|
|
|
|
Two days ago I had to send out an application. At the very last minute I was asked if I could add a splash screen to it and stupid me said yes. I had never done that before in my life. I tried to add a splash screen through Components and Controls but that works only for MDI or SDI. My application is dialog based. With only 20 minutes left (I couldn't go online and search codeproject) I decided to add my own splash screen. So inside OnInitDialog I have something like this:
CSplashDlg aSplashDlg( this );
aSplashDlg.DoModal()
Not being able to send a close message to CSplashDlg I just added a thread to CSplashDlg (a CDialog based class).
UINT SplashDelayThread( LPVOID pParam )
{
Sleep( 5000 );
::PostMessage( (HWND)pParam, WM_CLOSE, 0, 0 );
return 0;
}
int CSplashWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDialog::OnCreate(lpCreateStruct) == -1)
return -1;
AfxBeginThread( SplashDelayThread, this->m_hWnd,
THREAD_PRIORITY_NORMAL );
return 0;
}
Now I am afraid that this might cause race conditions. For example what if the thread is activated and then it returns before the Splash dialog is created. 5 seconds is a long time but should I be worried? I mean you never know.
// Afterall, I realized that even my comment lines have bugs
|
|
|
|
|
Hi Friends,
I am facing a problem in registering my COM DLL. We have build an Addin for a CAD application, which is a COM addin.
At some customer site, the addin dll is not getting registered. When we try to register using Regsvr32.exe, the exe returns an error code of 0x000000B6 . The error description is "The operating system cannot run %1." when viwed with 'Error Lookup' tool.
I searched on google newsgroups and i found 1 article stating this error occurs when the ATL.dll on the target machine does not match with the ATL.dll with which the addin dll (the DLL being registered) was built. And we have to use the mindependency build to remove the ATL.dll dependency.
Accordingly i found my machine has ATL.dll with version 3.0xxx. where as the client's machine has ATL.dll 2.0xxx. I replaced the ATL.dll with the one that i had and tried to register. Still the problem persists.
Any clues on the above problem ? This is the most urgent and most important issue for us.
Thanks and Regards,
Vikram
|
|
|
|
|
Did you check whether you have all the dependencies for your COM dll on the client's machine.
Also, if possible try doing the registration through some installer (like installshield). I had a similar problem, when I had previous versions of the same COM Dll on the user's machine, it went fine through a installer.
Cheers,
Kannan
|
|
|
|
|
Hi all,
I need to know is there any windows API call avialable to check who is presently logged in to the Windows 2000/NT/XP.
Thanks in advance.
|
|
|
|
|
GetUserName()
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
we use freelibrary() to free library in our client program.
but can we free the library by itself,if yes,how?
gucy
|
|
|
|
|
gucy wrote:
free the library by itself
What exactly do you mean by this?
|
|
|
|
|
Hi,
I need to build an application that loads a 200, 000 line
(or more) text file and lets the user interactively search
through it in memory, generating sub-lists of those 200, 000
lines with various search criteria.
I'm just wondering if it's wishful thinking to hope that
a standard list box can handle that many lines, and be
fast enough to traverse. If not, I wonder what other solutions or suggestions might there be.
Has anyone seen any applications that sound similar in
functionality to this?
All the string searching going on makes me think to use Perl,
but I don't know Perl at all. Also, I'm probably wrong, but
it's a command line only tool, isn't it?
Thanks for your time,
Shawn
|
|
|
|
|
You're best off using a virtual list box.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|