|
Hi all,
In a program I use "RemoveDirectory (LPCTSTR szName)" to remove a directory. However, this never seems to work. GetLastError () claims that "the process cannot access the file because it is being used by another process", which is not the case. I have no problem in removing the same directory from either a command-line or from the explorer. I am sure that the directory is empty (this is done in a preceeding bit of code in the same program).
Anyone any ideas?
Thanks in advance,
William
|
|
|
|
|
Wim Engberts wrote: I am sure that the directory is empty (this is done in a preceeding bit of code in the same program).
A missing FindClose(), maybe?
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
You are absolutely right! Never thought I'd need that after FindNext returned FALSE!
Thank you very much.
William
|
|
|
|
|
You are welcome.
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
I Created a dynamic Static control using CStatic.So i need to draw controls inside the Static control.
The problem is adding a Scrollbar , enable and using it.
CStatic temp = new CStatic();
temp ->Create(NULL, SS_GRAYFRAME |WS_VSCROLL| SS_REALSIZECONTROL , rect, parent);
So because of using WS_VSCROLL the Scroll was there but i dont know how to enable and use it.So please tell me how to do it or tell me a good web site about that.
hemajith
|
|
|
|
|
Why don't you declare it directly as a scrollbar?
CScrollBar *temp = new CScrollBar;
temp->Create (NULL,.......);
In that case you would have all the normal scrollbar's access.
William
|
|
|
|
|
Hi
Can anyone tell me how to override the F1 key, or any Function Keys from within a SDI application
thanks
simon
|
|
|
|
|
Handle WM_KEYDOWN event and check if the user presses the F1 key
if(nChar==VK_F1)
// Do something
else
// Do something else
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
thanks, but the code you suggested works with all keys apart from F1
any ideas ?
|
|
|
|
|
si_69 wrote: thanks, but the code you suggested works with all keys apart from F1
any ideas ?
ignore this, i now have it working
thanks
|
|
|
|
|
|
|
I was writing a control "CColorEdit" which is derived from CEdit. I have override its OnKeyUp() and OnKeyDown. When I pressed the key "Enter", the OnKeyDown was invoked, but OnKeyUp wasn't invoked. I feel very confused. Does anyone have ever occured this kind of think.
Waiting for answer.
Best Regards.
|
|
|
|
|
For sure you have put the messagebox code in OnKeyDown. Since the messagebox pops up in OnKeyDown, the focus is gained by the messagebox, so the OnKeyUp will not be handled on the edit box. I tested myself without the messagebox, and for me both keydown and keyup are working fine on a derived class of CEdit.
Habeeballah Hasnoddin
|
|
|
|
|
I think my code is OK. But it still doesn't work.
void CTestEdit::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default
if ( nChar == 13 )
{
//MessageBox("Down");
SetWindowText( "Bye Bye Bye" );
}
CEdit::OnKeyDown(nChar, nRepCnt, nFlags);
}
|
|
|
|
|
I got the point.
==> You must have "Multiline" and "WantReturn" properties set on this edit box.
As I observed while testing, the following is true.
--> If you set just the "Multiline" then only keydown gets fired and not the keyup.
--> If you set just the wantreturn and not the Multiline then only keyup gets fired and not keydown.
thats it.
Habeeballah Hasnoddin
|
|
|
|
|
Thank you very much.
You are so kind.
|
|
|
|
|
hai,
i am new to dll. any one please explain how to load bitmap in vb using vc++ dll
|
|
|
|
|
To load a bitmap from a file you can use LoadImage function (http://msdn2.microsoft.com/en-us/library/ms648045.aspx[^])
for instance:
HANDLE hBitmap = LoadImage(NULL, filepath, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
where filepath is a string containing the path of your bitmap file.
Note, you have to call DeleteObject(hBitmap) to perform cleanup when you've finished with the image.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
how can i create a dialog bar in my application..
I inserted the resource Insert->dialog-dialogbar..
When i try to create a class for my dialogbar, using class wizard.. the Base class CDialogBar is not displayed . . .
what can i do . .
Proud To Be an Indian
|
|
|
|
|
Do you mean toolbar?
If it's toolbar, you can do accroding to the following step.
1)create a toolbar resource "Insert->toolbar"
2)add a member
CToolBar m_wndToolBar;
3)add the following code in your OnInitDialog()
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(IDR_TOOLBAR1))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
m_wndToolBar.ShowWindow(SW_SHOW);
RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);
I hope it will works.;P
|
|
|
|
|
hey no its a DIALOG BAR . ..
Proud To Be an Indian
|
|
|
|
|
Hi,
I usually derive it from CDialog and rename the CDialog to CDialogBar
and
if you need you can simplify the create() function with
BOOL CYourDlgBar::Create(CWnd* pParentWnd, UINT nStyle)<br />
{<br />
return CDialogBar::Create(pParentWnd, IDD, nStyle, IDD);<br />
}<br />
And on your frame window create, dock your dialog bar
m_yourDlgBarObj.Create(this,
WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_CHILD |WS_VISIBLE |
CBRS_BOTTOM|CBRS_TOOLTIPS);<br />
<br />
m_yourDlgBarObj.EnableDocking(CBRS_ALIGN_BOTTOM | CBRS_ALIGN_TOP);<br />
DockControlBar(&m_yourDlgBarObj);<br />
|
|
|
|
|
OK its working now ... i followed what u said . . .
I had a button in the dialog bar . . but its disabled why . . .
Proud To Be an Indian
|
|
|
|
|
It is the property of MFC,
MFC disables controls if the handlers is not available
override OnUpdateCmdUI() this will enable all.
But MFC wants handlers for each control
Best Regards
Raj
|
|
|
|