|
Have you tried calling ::SetWindowPos on your window with flag HWND_TOPMOST ? If you're lucky enough that could do the job. Otherwise, the solution to your problem is going to be more convoluted.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I'm trying to understand how the string resources ids are converted into the actual strings as i ran into MAKEINTRESOURCE. A number of Win32 API calls accept string resource id wrapped in the above macro. Does anybody know what exactly does MAKEINTRESOURCE accomplish?
Here's how it is defined in WinUser.h
#define MAKEINTRESOURCEA(i) (LPSTR)((DWORD)((WORD)(i)))
Also, while looking at AfxLoadString, i came across the following code in DLLINIT.cpp
<br />
int AFXAPI AfxLoadString(UINT nID, LPTSTR lpszBuf, UINT nMaxBuf)<br />
{<br />
ASSERT(AfxIsValidAddress(lpszBuf, nMaxBuf*sizeof(TCHAR)));<br />
<br />
LPCTSTR lpszName = MAKEINTRESOURCE((nID>>4)+1);<br />
HINSTANCE hInst;<br />
int nLen;<br />
<br />
AFX_MODULE_STATE* pModuleState = AfxGetModuleState();<br />
if (!pModuleState->m_bSystem)<br />
{<br />
hInst = AfxGetResourceHandle();<br />
if (::FindResource(hInst, lpszName, RT_STRING) != NULL &&<br />
(nLen = ::LoadString(hInst, nID, lpszBuf, nMaxBuf)) != 0)<br />
{<br />
return nLen;<br />
}<br />
}<br />
<br />
What is going on here?? The string resource id is right-shifted 4 bits & added 1 & cast as LPSTR and finally assigned to a LPCTSTR variable - this is then used by ::FindResource & ::LoadString to fetch the actual string?? I'm beginning to lose it here!!
Anybody has ideas??
Chen Venkataraman
|
|
|
|
|
|
I think,
that when you do this
LPCTSTR Str= MAKEINTRESOURCE(RES_ID);
you do this
const char *Str= MAKEINTRESOURCE(RES_ID);
which means that your recieve a pointer to where the string is stored.
(*** I don't really sure, but I think that's what happens ***)
BTW: come to #CodeProject on DalNet (mIRC)
|
|
|
|
|
Resources can be identified with either a WORD (0-65535) or a string ID. All APIs that deal with resources take an LPCTSTR parameter as the resource ID. So when you need to refer to a resource with a numerical ID, you use MAKEINTRESOURCE to convert the WORD to a string, which then gets passed to the API.
As for what AfxLoadString() is doing, strings in the string table are grouped in 16-string chunks. (That's why the string table editor in VC has horizontal lines every 16 strings). When one string in a chunk is loaded, all strings in that chunk are loaded into memory at the same time. That code is doing an additional check to make sure nID is referring to a chunk that exists. Just an additional debugging aide, I guess.
--Mike--
http://home.inreach.com/mdunn/
Ford: How would you react if I said that I'm not from Guildford after all, but from a small planet somewhere in the vicinity of Betelguese?
Arthur: I don't know. Why, do you think it's the sort of thing you're likely to say?
|
|
|
|
|
I am developing a project in VC++ regarding mathematics using VC++/MFC. I want to plot "graphs" of various algebraic and trignometric expressions. If you know any article or if you have source code for "exprssion plotting" then please let me know through this forum or e-mail me. I shall be very thankful to you. There are few articles on codeproject that deals with statistical data plotting but not a single that plots the "expressions".
Imran Farooqui
email: imran@imilabs.private.as
Imran Farooqui
|
|
|
|
|
In my application, i consider 2 pointer on 2 array.
double *Qi1=new double[ni1];
double *Qi=new double[ni];
"i" and "i1"(=i-1) are 2 dates.
So, as we could see date i-1 is before date i. In my application i need to know all the value in the array which is pointed by Qi1, to calculate new values in the second array pointed by Qi(we note that ni>=ni1).
But, my pb is that as my application is iterative i do a for loop on the "i", so that at the end of all my calculation, just before going to the next step of the loop, i want that Qi "becomes" Qi1, like that i could continue the iteration, so i think that i have to do a reallocation of my tabs, and i don't know how we could do that. So could you give me a solution?
thanks in advance
gerald
|
|
|
|
|
use vector<double> instead of built-in arrays. Check your VC++ documentation on vector for further info.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Exactly my point
I vote pro drink
|
|
|
|
|
How I cam set the scrollbar position at the middle of the list control.
Thanks
|
|
|
|
|
ListView_EnsureVisible ( hwndList, ListView_GetItemCount(hwndList)/2, FALSE );
This will scroll the list so the "middle" item is visible.
--Mike--
http://home.inreach.com/mdunn/
Ford: How would you react if I said that I'm not from Guildford after all, but from a small planet somewhere in the vicinity of Betelguese?
Arthur: I don't know. Why, do you think it's the sort of thing you're likely to say?
|
|
|
|
|
Hello everybody. I'm new here, so I apologyze if this question is inadequate or has been answered before.
I usually program in VB in my job, but I'm using my little free time to learn C++. After learning the basics (I've programmed in C for some years, so the basics are easy), I'd like to do something useful for my VB programs in my company. I'd like to create some good looking flat buttons that get colored when the mouse is on them, and grey when the mouse leaves. I'd like to do it as an ActiveX control, so I can use them in my VB programs.
So what I'm looking for is a tip, an advice, something to begin with... maybe a url with examples or the name of a good book... maybe an article here???
Anyway, thanks in advance.
José C.
José Carlos Martínez Galán. Computer analyst and programmer.
I work in software developement since 1995. Mainly under Windows.
|
|
|
|
|
I'd recommend using ATL to create your control. Beginning ATL 3 COM Programming by Richard Grimes is a good book to get started with. I also found Programming Microsoft Visual C++ by Kruglinski to be useful.
There are some good ATL/COM articles on CodeProject and there are some very cool button controls too.
Michael
|
|
|
|
|
Add a CButton in an active X control...
how can I do that
Remi Morin
Rmorin@Operamail.com
Remi.Morin@Lyrtech.com
|
|
|
|
|
When invalidating the client area the background refreshes OK but the main toolbar does not.
Any ideas?
|
|
|
|
|
something like:
((you'rMainFrame*)((You'rApp*)afxGetApp())->GetMainWnd())->m_ToolBar.Invalidate();
I'm not sure, it's an Ideas
Remi Morin
Rmorin@Operamail.com
Remi.Morin@Lyrtech.com
|
|
|
|
|
I have collected all the items on the dialog by executing
"GetNextDlgTabItem()", this function returns the pointer of CWnd. now i want to know whether this pointer points to a "CButton"Object or "CEditBox" Object.
I mean i want to know the type of control.
or any other solution in your mind..
.......
I want to get the collections of items on a dialog Box and then manipulate these items according to their type.
|
|
|
|
|
Use IsKindOf()
like this
CWnd* pWnd = GetNextDlgTabItem();
if(pWnd && pWnd->IsKindOf(RUNTIME_CLASS(CEdit)))
//edit box
else if(pWnd && pWnd->IsKindOf(RUNTIME_CLASS(CButton)))
//button
else
//whatever
|
|
|
|
|
void CButtonReplacerDlg::DialogManipulator()
{
CWnd* pWnd=GetActiveWindow();
CWnd* tempWnd,*backupWnd;
backupWnd=GetNextDlgTabItem(pWnd);
tempWnd=backupWnd;
while ((pWnd=GetNextDlgTabItem(tempWnd))!=backupWnd)
{
tempWnd=pWnd;
CString str;
pWnd->GetWindowText(str);
AfxMessageBox(str);
if (pWnd->IsKindOf(RUNTIME_CLASS(CButton)))
{
AfxMessageBox("Button");
}
else if ( pWnd->IsKindOf(RUNTIME_CLASS(CEdit)))
{
AfxMessageBox("EditBox");
}
else if ( pWnd->IsKindOf(RUNTIME_CLASS(CStatic)))
{
AfxMessageBox("Static");
}
}
}
Chief ....I have tried IsKindOf() but it not works well...It only works for the first CWnd pointer, but not works for the rest...... U create a few buttons and Edit Box and static box on a dialog and check the above function. U come with the problem i face....Thanks for earlier help.
|
|
|
|
|
Hi,
I think IsKindOf() only works if you have subclassed the control with an MFC object (for example using ClasWizard to add a variable).
The right way is checking the window's class - see GetClassName(). You may check the class name of your controls with Spy++.
Paolo
------
"airplane is cool, but space shuttle is even better" (J. Kaczorowski)
|
|
|
|
|
You need to use ::GetClassName. This will tell you the window class that was registered with windows. "EDIT", "BUTTON", "COMBOBOX", "LISTBOX" are common ones, use Spy+ to find out others.
|
|
|
|
|
Someone clicks file and save and alot of individual text files are saved. How can I bundle those text files into one (1) single file that has the extension .abc or .dae or whatever, just some extension other than a .zip? I just want to bundle the files together some how and then when they click retrieve unbundle that file into it's little individual text files.
Any ideas? Any response any one can give me will be greatly appreciated.
Sincerely,
Danielle (an overworked graduate student)
|
|
|
|
|
If you can separate the individual text files with some unique character sequence (like 15 newlines in a row, or some other sequence), you can just write the texts to the file one at a time, writing an end-sequence after each text. When loading you read one char at a time until you hit the end-sequence. Then you start a new text and read on into this new one.
Another possibility is to make a header to write to the file first. It contains the number of texts in the file, their sizes and their starting offset into the file. Reading the file should be trivial.
Cheers
Steen.
"To claim that computer games influence children is rediculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
Could I use the lParam value of the TVITEM struct to store a pointer to a Cobject? If so, how would I do this? Thanks,
WAVK
|
|
|
|
|
treeitem.lParam = (LPARAM)*MyObj;
|
|
|
|