|
Hi.
You can use the Ole drag and drop.
It's a little tricky at first, but works fine.
You can find some example on this web site.
Search for Ole Drag and Drop.
Here's a tip.
Add the methos OnDragEnter(...) and OnDragOver(...), in your drop target, and add the following code in it:
return DROPEFFECT_COPY (or MOVE).
It took me 3 days to find that.
I hope this helps.
|
|
|
|
|
Hi,
I am using a CArrayRowset to populate rows in a virtual listview from a Jet 4.0 database.
As the user moves back and forth through the list the underlying CArrayRowset is left pointing to the furthest record loaded sequentially from the database.
My question is about updating data. The user selects an item in the listview which is different to the record currently pointed to by CArrayRowset, this item is cached in the CArrayRowset and so does not cause the record pointer to move.
To update this I need to be able to move the CArrayRowset's record pointer to the selected record and this is the bit I can't quite work out - I've looked at the CBookmark class briefly but it seems to me that in order to get a bookmark to the required row, I'd have to be on the row anyway which kinda defeats the whole purpose - maybe I'm misunderstanding the use of this class.
Can anyone help me with this one? I've done a quick search through deja but not found a great deal of information. This isn't the first time I've hit this issue with CArrayRowset, in the past I've avoided the problem by using a second rowset to edit the record, this worked OK because the listview contained lots of columns and a row displayed an editing dialog.
In this case, however, I want the editing to be inplace and using a second rowset seems a bit messy, especially when considering how to handle deletions.
Thanks for reading this message.
Regards,
Jason Wilden.
modified 10-Jul-19 21:02pm.
|
|
|
|
|
Hi,
I am trying to write a small utility that allows users to customise the icon of my program, which is a precompiled EXE (similar in function to MicroAngelo etc, but much simpler, with only the option of choosing the new icon, which will then be applied to the EXE). I believe UpdateResource() can do this for NT (and the _UpdateResource class over at http://www.codeguru.com/misc/resources.html does pretty much the same for Win 9x). However, I can't figure out how to use UpdateResource correctly. I can't even get the sample code from MSDN to compile correctly.
Could anybody tell me how I can use BeginUpdateResource(), UpdateResource() and EndUpdateResource() to swap the icon in an EXE file for another .ico file (ie the end user will just have to select an .ico file)?
Many, many thanks to anybody who can help or give me any pointers.
All the best,
KB
|
|
|
|
|
How To Code a Meter To Track the Amount of Data Sent/ Recd from some Internet Connection
Manish Bhatia
|
|
|
|
|
Scenario :-
Main Dialog -> Child Dialog
[Means we have a main CDialog derived modal dialog, which brings up a second modal child dialog]
Child Dialog - CFrameWnd derived class F
[The child dialog creates and shows a CFrameWnd derived class F
in F's OnCreate() we do this :-
We create a CHtmlView derived class.
This is done calling CHtmlView::Create(...)
Now the problem is that Create fails and returns false
If I bring it up from the main dialog, it works.
It only fails when I bring it up from the 2nd dialog
Is there any way to figure out why and how Create is failing
This project is compiled with the /clr option by the way as it uses a good amount of managed code. Thus the debugging features are sorta mostly useless.
I created a test dialog app, added a child dialog and popped up a frame window with the CHtmlView derived view and made it a /clr app. That worked with no issues at all.
Do you guys think that with all the managed code, I am causing some kinda memory overflow or some other problem for MFC???
I feel miserable!
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
|
Guess what!!
I created and showed my frame window before all the managed stuff and now there are no problems. Weird eh?
of course this hasnt solved my issue. The last thing I want is to have the frame window jumping up before even the dialog is shown
Can someone throw some light on this pathetic darkness???
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
Okay, so here's my rather ugly and stupid work-around.
Create my frame window in my OnInitDialog but turn off the visible bit in the flag.
Now whenever I want to bring up the framewindow with my custom view I do a ShowWindow with SW_SHOW
Of course now I have to override WM_CLOSE in the framewindow and instread of actually closin it I hide it
And I dont have to bother about a leak because the framewindoiw is destroyed when the dialog is closed because the framewindow's parent is set to the dialog CWnd
Cool, eh?
Regards
Nish
p.s. I know this sounds really silly and ugly, hey that rhymes, silly, ugly , well coming back to what I was saying, I dont have any other smarter ideas!!!
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
You may consider writing an article to share with us all this kind of tricks.
Best regards,
Alexandru Savescu
|
|
|
|
|
|
Hi,
How can i place the bitmaps in tab control header(without using MFC)?
thanks
Neha
|
|
|
|
|
Does one exist without #including <windows.h> and using Sleep()?
Sprudling
|
|
|
|
|
Sprudling wrote:
Does one exist without #including and using Sleep()?
Are you asking for a portable solution or what is your problem with using just Sleep()
--
Daniel Lohmann
http://www.losoft.de
|
|
|
|
|
I take it there is no such function, and there is no problem really except compiling takes 10 times longer when not using precompiled headers.
Sprudling
|
|
|
|
|
Oh the compiling time - I see.
You could decrease it a lot by defining some symbols to exclude rarly used stuff from the windows headers:
#define WIN32_LEAN_AND_MEAN
in front of your #include statement should help a lot.
But of course, you could also take the one-line definition of Sleep out of the header and define it on your own, so you just don't need the header:
extern "C" void Sleep( unsigned int msec );
should do it (don't forget to link against kernel32.lib)
--
Daniel Lohmann
http://www.losoft.de
|
|
|
|
|
How to distinguish from MO,Zip and Card reader without finding out lable. Because they are the removable device,I have trouble of them.There are the code I worte...
nLength =GetLogicalDriveStrings(MAX_BUFFER, szDrives);
if ( nLength )
{
do
{
strDrive = szDrives + i;
strDrive.MakeUpper();
if ( strDrive[0] >= 'C' )
{
if(GetDriveType(strDrive)==DRIVE_REMOVABLE)
{
if ( SHGetFileInfo ( strDrive, 0, &sfi,sizeof(SHFILEINFO),SHGFI_DISPLAYNAME ))
{
str.Format("%s ",sfi.szDisplayName);
m_name.AddString(str);
}
}
}
i += strDrive.GetLength() + 1;
} while ( !(szDrives[i - 1] == '\0' && szDrives[i]== '\0') );
}
Could you help me?
Thanks a lot.
|
|
|
|
|
Does anyone knows , why sometimes fopen failes , but GetLastError returns 0.
And which is more interesting , is although fopen fails , the file actually has been created.?
Thanks.
|
|
|
|
|
I don't think fopen sets the last error code on failure - GetLastError is a Win32 thing, whereas fopen is part of the C run-time library.
Don't know why the second bit should happen - it always helps to look at the source for the library (although you may not have it installed).
Stuart Dootson
'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
|
|
|
|
|
Try to use CreateFile and then GetLastError.
Best regards,
Alexandru Savescu
|
|
|
|
|
I want list the windows controls in a selection region. Is it possible? How?
Here I am going to draw a rectangle in any region of window.
VIKS
|
|
|
|
|
Yep. No problem
Just
1st) enumerate all windows in system (EnumWindows, or, much eaier in case of ONE target window - EnumChildWindows)
2st) determine if they do have target window (one, or did i mis anything?) like
BOOL CALLBACK EnumChildProc(HWND hWnd, LPARAM lParam)
{
CMyDlg *pDlg = (CMyDlg*)(AfxGetApp()->m_pMainWnd);
HWND hTempWnd = hWnd;
while (hTempWnd != NULL && pDlg->IsTargetWnd(hTempWnd ))
hTempWnd = ::GetParentWnd(hTempWnd );
if (hTempWnd == NULL)
return TRUE;
...
}
3rd) get their rects with GetWindowRet,
4th) if needed convert them into client coordinates (ClientToScreen & back ScreenToClient)
5th) check if they lay inside traget rect with (IntersectRect and some additional work in case of target rect lays fully inside some controls)
6th) that all falks, like MGM said
Cryst
|
|
|
|
|
I wnat to run another prog. in my prog.
So I need seng messare to the prog.
I have two questions:
1.What's wrong with the following code and How to send message to a check ctrl?
HWND hEditFilter = GetDlgItem(g_hExefile, ID_CHECK_EDIT); // return NULL???
// g_hExefile is the handle of another prog's dialog.
PostMessage(g_hExefile, BM_SETCHECK, ID_CHECK_EDIT, 0); // no respond
// I want to set the check ctrl in FALSE state.
2.How to send message to a commom dialog(like OK button)?
Thanks.
No pains, no gains.
|
|
|
|
|
Heare are the steps and code to send messages to another program.
1. Remember that on Windows all are windows, so you need to get a HWND to your target window.
2. With the target HWND you call GetDlgItem to retrieve a handlw to window control.
3. Send the message to the window´s control directly.
code:
// buffer to get the target caption window returned by
// GetWindowText
char szWindowName[60];
CString szTargetWindowName = "MyApp"; // Target window
int nFound;
int nLength = strlen(szTargetWindowName);
HWND hSearchHandle;
//Search around our "MyApp"
for(hSearchHandle=::GetWindow(::GetDesktopWindow(),GW_CHILD);hSearchHandle; hSearchHandle = ::GetWindow(hSearchHandle, GW_HWNDNEXT))
{
::GetWindowText(hSearchHandle, szWindowName, 20);
szWindowName[nLength] = '\0';
nFound = lstrcmpi(szWindowName,szTargetWindowName);
if(nFound == 0)
{
CWnd pCwnd;
// WPARAM 1: Check, 0: uncheck
::SendMessage(::GetDlgItem(hSearchHandle,<put heare="" your="" control="" id="">, BM_SETCHECK,1,0);
}
}
if you have any problem with the code above contact me .
Asta la vista.
|
|
|
|
|
Thanks for giving me help.
I think the code may has some problem.(I didn't test it yet.)
I want to send BM_SETCHECK message to an edit(ID = ID_EDIT_START) and your code showed that you send BM_SETCHECK message to main window. It won't work.
So I need to get the edit control's handle (It's where my problem really exists, I can't get the handle). By the way, the external dialog program has several edit controls.
Thanks again.
Richard Woo
No pains, no gains.
|
|
|
|
|
I made a mistake with the former reply.
I tried this:
::SendMessage(::GetDlgItem(hSearchHandle, ID_EDIT_START), BM_SETCHECK, 1, 0);
No response at all.
I have solved it in another way.
My question has a little change.
How to get a special edit control in a dialog program's handle?
Could you help me?
Thanks a lot.
Richard Woo
No pains, no gains.
|
|
|
|