|
|
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
|
|
|
|
|
Borland IDE[^].
You see a man walking on the ice field, and that is the Windows desktop image. I am not telling you to use Borland tools as develop one, I am just talking about the IDE. You may develop your apps this way.
Maxwell Chen
|
|
|
|
|
Hi Maxwell,
Thanks for the idea!
Best,
Eric
|
|
|
|
|
I am trying to access a specific area of memory in another application and was wondering if anyone had any ideas on how to make that happen.
|
|
|
|
|
|
One possible way is to access it directly, all you need to know is the address in another process that you want access/modify:
1. If necessary enable SeDebugPrivelege for your process.
a. OpenProcessToken (..,TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY )
b.LookupPrivilegeValue
c. AdjustTokenPrivileges, CloseToken
2. OpenProcess with desired access (PROCESS_VM_READ .. )
3.ReadProcessMemory/WriteProcessMemory
HTH,
Edward
|
|
|
|
|
Hi everyone.
I have an existing MFC based GUI Windows application to which I would like to add functionality so it can also run as a Service.
I have good understand of how a Service works and I've written one from scratch but I'm stumped on how I can convert an existing MFC based GUI app to run as a Service. The problem is how to do all the required MFC initialization when the SCM calls my app.
My first thought was to implment the startup code myself and simply handle a command line arg to determine if I should run as a Service or not. I can then intercept the startup before InitInstance() is called and my GUI is displayed. Of course I would implement the required Service methods such as 'ServiceMain' and 'ServiceControlHandler' then based on the command line arg I would hand of startup control to these methods and away I go to running a Service.
Then I looked at how much MFC is doing before it calls InitInstance() on my app and realized writing my own 'WinMain' isn't going to be trivial.
So basically I'm looking for advice on how to handle this. I could just write a standalone Service based on this app but I would love to just have one module which is dual purpose.
In writing this I just had a thought. Shouldn't I just determine if I'm running as a service or not in InitInstance() and go from there? Maybe that's the solution but I've typed this all out so I might as well post it.
|
|
|
|
|
although I may not be perfect but I think services are background processes that run in the background without any user intervention.
I developed a service which was a router. As you can understand routers are suitable for these kind fo applicaton (service) who once need to be configured and then they play their role quitely in the background i.e. routing.
Well, to configure that router, I made another MFC GUI application. This application is launched from a user (normally System Administrator) to configure the router. Administrator configures the router by using this GUI tool and the closes it and once again router starts its work according to new settings.
I dont think of any GUI application as a candidate to be a service. I dont even see any windows service implemented in this way.
Think on your application whether it is a candidate to become a service!!!
|
|
|
|
|
Thanks for the tip hashimsaleem.
Well as I said at the end of my post I figured out what I needed to do by the time I finished posting my question. Basically I wrote all the Service functionality and just made my app run as Service or instantiate the Dialog (or main window) depending on how it was started. It was pretty simple.
|
|
|
|