|
KingKruncher wrote:
is there another way
Yes there is (actually more than one). One of them is to use GetFileAttributes to check for the existence of a file or directory. Take a look:
if (GetFileAttributes(TEXT("c:\\some_directory")) == (DWORD)-1)
{
if (GetLastError() == ERROR_FILE_NOT_FOUND)
{
if (MessageBox(NULL, TEXT("Directory c:\\some_directory does not exists. Would you like to create it?"), TEXT("Please Confirm"), 0) == IDYES)
{
}
}
}
Hope this helps.
Gurmeet S. Kochar If you believe in God, it's because of the Devil
My CodeProject Articles: HTML Reader C++ Class Library, Numeric Edit Control
|
|
|
|
|
Thank you alot Gurmeet S. Kochar. That still doesn't seem right, but it's better than what I had. Thanks again.
wWw.KruncherInc.cOm - My cool programs
|
|
|
|
|
|
Well, I was just thinking there would be a function called "DoesDirectoryOrFileExist" or something like that, but I just couldn't find any thing.
wWw.KruncherInc.cOm - My cool programs
|
|
|
|
|
I am trying to open a popup menu from a menubar without progmatically, without the mouse necesarily being near the menu and without SendInput.
SendMessage( targetWindow, WM_SYSCOMMAND, SC_MOUSEMENU, lParam );
The documentation for SC_MOUSEMENU says "Retrieves the window menu as a
result of a mouse click.". Now I know the parameters I send are correct, but it does nothing. Can someone explain why it doesnt work? Or possibly explain how I could get it to work?
lParam = MAKELPARAM( screenIntersect.x, screenIntersect.y );
I have matched my screenIntersect to the values I got from Spy++ just to ensure they were correct compared to normal ( not gernerated by me )
messages.
I know I can send ALT+downarrow key command to open the first menu.. only problem with that is if the menu is already in tht "ALT" state sending another ALT will turn that state off. Also its not really the same since the ALT state will wait for a hotkey, not what normall happens when you open a menu with a mouse click.
Thanks,
|
|
|
|
|
I need to develope a text editor that can also display bmp images. I need to perform clipboard functions on bitmaps as well as text.
I m inheriting a new class from CEdit and having a CBitmap member variable. I want to override the CEdit paste (infact clipboard methods) method so taht I can display bitmaps alongwith the text since CEdit allows only CF_TEXT format.
I cant find any way at the moment to do this.
A lot of thanks for the suggestions.
|
|
|
|
|
|
OK. I try to see whether CRichEdit provides this functionality and how to use it. but isnt there anyway to override CEdit::paste??
|
|
|
|
|
|
I am testing on Windows XP with Fast User Switching.
Our drawng code goes through our own DrawRect function which is a wrapper for Rectangle().
Our function checks the return value from Rectangle, which is a bool. Microsoft says to check GetLastError when Rectangle fails. I did and it rturns '5' - access denied after switching away from the current user, to another user, and then coming back to the original user.
Anyone else ever seen this error come back for the Rectangle call?
I have stepped through the program, and if I let the drawing continue everything --appears-- to be fine
|
|
|
|
|
Hello,
I'd like to retrieve blob fields (which contains jpeg file) from MySQL queries without file access.
My current solution is w/ file access : fwrite(row[1],1,lengths[1],pOutFile); (like examples from MySQL.org) + Bitmap image(path to saved file) and I'm not satisfied ...
TIA
lbe
|
|
|
|
|
If I remember correctly this can be accomplished using streams. Allocate global memory of the correct size using GlobalAlloc(), read your blob data into that memory, use CreateStreamOnHGlobal() to make an IStream object containing your data, then use Bitmap::FromStream() to read the data into a bitmap object.
and no, I do not have code that does this
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Assume row[1] comes from "mysql_fetch_row" and is a BLOB. The code below works for me :
LPVOID pvData = NULL;
HGLOBAL hGlobal = GlobalAlloc(GMEM_MOVEABLE, lengths[1]);
pvData = GlobalLock(hGlobal);
CopyMemory(pvData, row[1], lengths[1]);
GlobalUnlock(hGlobal);
IStream * pStream = NULL;
HRESULT hr = CreateStreamOnHGlobal(hGlobal, TRUE, &pStream);
Bitmap * image;
image = Bitmap::FromStream(pStream);
pStream->Release();
|
|
|
|
|
sorry for repost
i have an edit box and a button add on a tab (i have 3 tabs on a dialog..each tab is a seperate dialog using property page)...im trying to have it where if a user press enter in the edit box it will execute the button add (call on the add function which the button is mapped to)..how can i do this? this is a single line edit box
i've tried onchar event for that dialog and it's not detecting when i type in that edit box...
i've also tried default push button property for that button and it's also not working
any suggestions? thanks
|
|
|
|
|
You need to process WM_GETDLGCODE message and return DLGC_WANTALLKEYS + whatever edit control returns (don't remember if DLGC_WANTCHARS would be enough), in order to receive this keyboard message message. Or you can make it a multiline edit contrl (ES_MULTILINE) with ES_WANTRETURN style.
Edward
|
|
|
|
|
|
handle this in your WM_COMMAND message:
case IDC_EDIT2:
if(HIWORD(wParam) == EN_CHANGE)
SendMessage(hDlg,DM_SETDEFID,(WPARAM)IDOK,0);
break;
wWw.KruncherInc.cOm - My cool programs
|
|
|
|
|
in your Dialog class override the PreTranslateMessage(MSG* pMsg)
{
//check the keys in your case the enter key
if(pMsg->message == WM_KEYDOWN && pMsg->wParam ==VK_RETURN)
{
//chek is the focus is in your edit control
// let the Control id of your edit is IDC_EDIT1
CWnd *pWndFocus = GetFocus();
if (pWndFocus->GetDlgCtrlID() == IDC_EDIT1)
{
AfxMessageBox("Enter Key in your Editbox");
}
}
}
}
I want to change Myself..Can u help me?
|
|
|
|
|
I have an SDI app thats based on CFormView.
Lets say I have two dialog forms. When the program starts, it will start with one of them as its main view.
I want to have an option to switch to the other dialog form, and have it as the main view. I'm not sure how to do that.
Basically, what I have is two SDI apps, both based on CFormView. I want to combine those two into one SDI, CFormView based app.
Can anybody help me on this?
It may be easier with an MDI app, but I'd rather use SDI.
I hope I've made myself clear, if not, I'll try to explain it better. I'm not good at explaining things.
Thanks!
|
|
|
|
|
Daniel1324 wrote:
It may be easier with an MDI app, but I'd rather use SDI.
Switching Views in a Single Document Interface Program[^]
Michael
But you know when the truth is told,
That you can get what you want or you can just get old,
Your're going to kick off before you even get halfway through.
When will you realise... Vienna waits for you? - "The Stranger," Billy Joel
|
|
|
|
|
|
dont worry. i am planning to post an article on Form Switching in SDI application.
I want to change ..Can u help me?
|
|
|
|
|
Hi everyone,
I am starting a program that will allow serveral files to be viewed at once. My idea is to start with a dialog based app and then open other windows (sort of like views) to show each file. The files will be chosen from the main dialog of the app. The main dialog will also keep a list of the open files (windows) and allow the list of open files to be saved, and it will have a 'New' button so that new files can be created.
My question is about how to go about making these 'view' windows. I don't want to use MDI (since I want the user to be able to move the windows around without them all being stuck in a frame) and I can't use modal dialogs since they would block access back to the main app's dialog while they're open.
I was thinking about using modeless dialogs or going through the process of AfxRegisterWndClass and 'rolling my own' display windows.
What ideas do you have about how I should approach this. If I do my own windows, I'll need to handle mouse and keyboard events within them, and it seems like that stuff is somewhat provided (skeleton laid-out at least) to me if I use dialogs.
Thanks much, best regards,
Eric
|
|
|
|
|
Have a look at the style of the IDE of "Borland C++ Builder" ......
Maxwell Chen
|
|
|
|
|
Hi Maxwell,
I don't have ready access to Borland Builder. Can you point me to some ideas on the web. Searching Google gave me some ideas, but from what I can tell it looks somewhat like the Visual Studio IDE.
Thanks for the reply!
Eric
|
|
|
|