|
Of cource it is possible to create a listctrl in report view but about comboboxes it is better to check ListCtrl part in CP maybe there is something there.
Mazy
Don't Marry a Person You Can Live With...
Marry Someone You Can Not Live Without
|
|
|
|
|
Hi All,
I have a parent window that contains an OLE object. I want the OLE object to draw on its parent's DC (for animation). This isn't too much of a problem, as I can get the parent CWnd and associated DC.
The problem is however - I have pre-written code to do the drawing that expects to start drawing at 0,0. This means the graphic is always at the top left of my parent window. What I want to do is shift the graphic to the right and down so it's above the object.
I *think* what I want to do is shift the whole parent DC to the right and down, but I'm not sure how to go about this.
Any help greatly appreciated.
Paul.
|
|
|
|
|
<a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmfc98/html/_mfc_cdc.3a3a.setviewportorg.asp">CDC::SetViewportOrg</a> is what you need, I guess.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi,
Thanks for your post.
I currently have the following code:
CRect recOLEObject; //Set using GetWindowRect when I activate
//the OLE object temporarily
CRect recApp; //Set using GetWindowRect
CPoint ptDCShift;
ptDCShift.x = recOLEObject.left - recApp.left;
ptDCShift.y = recOLEObject.top - recApp.top;
pDC->SetViewportOrg(ptDCShift);
The wierd thing is, as I start and stop the animation the amount of shift changes (never being in the right place, I should point out), and 'steps' down the screen.
Paul.
|
|
|
|
|
Sounds like you need to reset the viewport to what it was originally after you're done.
farewell goodnight last one out turn out the lights Smashing Pumpkins, Tales of a Scorched Earth
|
|
|
|
|
Now look at the code Mike Dunn (or anyone):
void CWallpaperDlg::OnButton1()
{
CoInitialize(NULL);
HRESULT hr;
IActiveDesktop *pActiveDesktop;
//Create an instance of the Active Desktop
hr = CoCreateInstance(CLSID_ActiveDesktop, NULL, CLSCTX_INPROC_SERVER,
IID_IActiveDesktop, (void**)&pActiveDesktop);
if(SUCCEEDED(hr))
{
hr = pActiveDesktop->SetWallpaper((LPCWSTR)"C:\\Mina dokument\\Mina bilder\\eros15.gif", 0);
if(hr != S_OK)
AfxMessageBox("Fail?");
}
else
{
AfxMessageBox("dgfd");
}
// Call the Release method
pActiveDesktop->Release();
CoUninitialize();
}
Well, as you see I check if the code is NOT S_OK but the dialog will never show up.
but how to get it Unicode? I've tried type cast it with many Unicode types but is always says "cannot conver from ... to ..."
------------------------------------
<b><I><B>Rickard Andersson</I></B></b>, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
Your attempt to get a LPCWSTR by forced casting is wrong. Instead, use wide char literals like this:
hr = pActiveDesktop->SetWallpaper(L"C:\\Mina dokument\\Mina bilder\\eros15.gif", 0); Note the L prefixing the string.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
With your help and with some small "brainstorming" I'd get it to work!
I had to call ApplyChanges(...) after call of SetWallpaper to see the wallpaper.
Thank you!
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
Hi,
Where shall we declare an array to be assigned in a function of a class and accessed in a function of other class?
|
|
|
|
|
1. make a member variable in one of the classes.
2. when you call the function in the other class, pass it a pointer to the instance of the first class as an argument.
eg:
class bob
{
public:
int nAge;
}
class fred
{
public:
void LaughAtBobsAge(bob* bobclass);
}
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
Hi,
Can someone tell me the Registry entry that can tell me who is the current user for Win95-XP
Thanks
San
|
|
|
|
|
You can get user name from environment variable USERNAME. Use GetEnvironmentVariable function.
|
|
|
|
|
This is for Win98
Key :- HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control
String :- Current User
Nish
Nish was here, now Nish has gone;
He left his soul, to turn you on;
Those who knew Nish, knew him well;
Those who didn't, can go to hell.
I like to on the Code Project
Sonork ID 100.9786 voidmain
www.busterboy.org
|
|
|
|
|
Same format for Win95 OSR2.
Anyway, why not rely on good ol' <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/sysinfo_9jj9.asp">GetUserName</a> instead of look into the registry?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Joaquín M López Muñoz wrote:
Anyway, why not rely on good ol' GetUserName instead of look into the registry?
Dunno! Sanskypotov wanted to know where it's stored in the registry. Maybe he wants to try changing it and seeing if it will have any effects on some SAMBA share on his network
Nish
Nish was here, now Nish has gone;
He left his soul, to turn you on;
Those who knew Nish, knew him well;
Those who didn't, can go to hell.
I like to on the Code Project
Sonork ID 100.9786 voidmain
www.busterboy.org
|
|
|
|
|
I have a VC++ editor and i want to track the changes in the editor.Means i first load the entire content of the editor in an array .After i executed a function at that time i can change the editor .How i can make an array that reflects the mirror copy of the changes in the editor.
CStringArray strText; contains the original array
then i called the function
after that i can change the content of the above mentioned editor .
my requirment is how i can tap the changes in the editor to my array strText.I need to copy all changes in the editor to the original array
Please help
|
|
|
|
|
If you used std::vector or std::list instead of CStringArray, you would probably find an algorithm provided by the standard library that does this for you, or it would be easy to write one, which would go through line by line, and make a new vector of just the lines that had been changed.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Picture the daffodil. And while you do that, I'll be over here going through your stuff.
|
|
|
|
|
Hi !
I managed to insert several ActiveX controls in Ms Word, using:
[ccode]
Selection.InlineShapes.AddOLEObject
[/ccode]
Now I want to load the document in my app and iterate through all that ActiveX controls in order to set some properties, how can I do that ?
( I have tried with GetSelection adn GetInlineShape, but without success... ).
Thanks, in advance, Bye !
Braulio
|
|
|
|
|
Hello,
I'm working on a MDI project and I'd like to insert a bitmap in the background of my application, in other words, on my MainFrame window, behind the children windows. This bitmap will be always there. I'm workin with VC++ 6.0 and Windows 2000. If anybody know how to this, please, help me.
Best Regards,
Igor Kondrasovas
|
|
|
|
|
It's very easy use GDI+.Check this and this
Mazy
Don't Marry a Person You Can Live With...
Marry Someone You Can Not Live Without
|
|
|
|
|
It's simple task, but many steps are required:- Create a new
CWnd -derived class, say CBackgroundWnd .
- Add these two members to
CBackgroundWnd :
CBitmap m_bitmap_background;
BITMAP m_bmInfo_background; along with this piece of code in CBackgroundWnd ctor:
m_bitmap_background.LoadBitmap(IDB_BACKGROUND);
::GetObject(m_bitmap_background,sizeof(BITMAP),&m_bmInfo_background);
- Add a handler for
WM_ERASEBKGND in CBackgroundWnd and plug this code (which draws the bitmap in tesellation mode)
BOOL CBackgroundWnd::OnEraseBkgnd(CDC* pDC)
{
CRect rect;
GetClientRect(rect);
CDC dcMem;
dcMem.CreateCompatibleDC(pDC);
HBITMAP* pBmpOld=(HBITMAP*)::SelectObject(dcMem.m_hDC,m_bitmap_background);
for(int y=rect.top;y<rect.bottom;y+=m_bmInfo_background.bmHeight){
for(int x=rect.left;x<=rect.right;x+=m_bmInfo_background.bmWidth){
pDC->BitBlt(x,y,m_bmInfo_background.bmWidth,m_bmInfo_background.bmHeight,
&dcMem,0,0,SRCCOPY);
}
}
::SelectObject(dcMem.m_hDC, pBmpOld);
return TRUE;
}
- Add a member of type
CBackgroundWnd to your CMainFrame class, say m_wndClient .
- Override
CMainFrame::OnCreateClient with this:
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
if(!CMDIFrameWnd::OnCreateClient(lpcs, pContext))return FALSE;
m_wndClient.SubclassWindow(m_hWndMDIClient);
return TRUE;
} That's it, I think. Good luck.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Why couldn't he just erase background in the mainframe ?
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Picture the daffodil. And while you do that, I'll be over here going through your stuff.
|
|
|
|
|
Good question... I created a test MDI project and tried that approach first, to discover that my tesellation got overdrawn by the standard dark-grey background (I noticed because of the flickering). I remembered then about that funky, mostly unknown CMainFrame::m_hWndMDIClient member and how it seems to take on some of the roles people tend to ascribe to CMainFrame itself... got it subclassed and WM_ERASEBKGND -handled, and it worked. Couldn't say if this is the most direct approach. Any ideas?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Interesting - I've only ever done this in a view, so I had no idea of this problem. Sounds like it's worth a fiddle sometime.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Picture the daffodil. And while you do that, I'll be over here going through your stuff.
|
|
|
|
|
...so I had no idea of this problem
Neither did I Thought I'd write a test before submitting an answer, and came to this (to my surprise).
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|