|
I think you need to look in the SetCooperateLevel function (I think that's the name, anyway, or something like it). Also, it would be good advice to look at the DirectX sample progras, they are a gold mine.
--
Andrew.
|
|
|
|
|
How does one create an owned popup window?
If I use
CreateEx(NULL,
AfxRegisterWndClass(CS_HREDRAW | CS_VREDRAW, 0, (HBRUSH)(COLOR_WINDOW + 1), 0),
NULL,
WS_POPUP | WS_VISIBLE | WS_BORDER,
rect,
pParent,
1,
NULL); CreateEx fails to create a window
but, if I use
CreateEx(NULL,
AfxRegisterWndClass(CS_HREDRAW | CS_VREDRAW, 0, (HBRUSH)(COLOR_WINDOW + 1), 0),
NULL,
WS_CHILD | WS_VISIBLE | WS_BORDER,
rect,
pParent,
1,
NULL); CreateEx successfully creates a window, but it's visibility is limited to it's parent's client area.
My class is derived from CWnd, and I call CreateEx() in the constructor.
TIA
TA.
|
|
|
|
|
Does noone use use CWnd::CreateEx() to create a popup window
why would CreateEx() fail when the WS_POPUP flag is used, but if I use the CreateWindowEx() API function, with the exact same parameters as above, the window is successfully created?
I am very confused, and in the 2 days since I posted the original question, I have not gotten an answer. maybe this forum is not as helpful as I have been told
|
|
|
|
|
How can I skin a window?
for example: Title, Window client area, Tool Bar, Menues, Fonts, etc.
Every help needed links.
Anything . . .
Please HELP ! ! !
A S A P.
Thanks.
|
|
|
|
|
You have to write a skin parser, drawing code to put it all in the right places (resize wigits, buttons, icons, etc).
After that, you have to link all these icons and buttons to actual functionality, send window-grip messages, and more.
Needless to say rewriting a UI is a lot of work.
// Rock
|
|
|
|
|
This should get you started:
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
sorry 4 the mistake, guys.
But I meant: How can I skin an Explorer Window ?
Please HELP.
Thanks
|
|
|
|
|
Window blinds....
It would be a lot of work otherwise (way WAY more than your own program) because you have to listen for draw messages from all over the place and do your own drawing once windows is done its thing.
Not prety, and not worth it since window blinds does all this for you already.
// Rock
|
|
|
|
|
CLaW wrote:
window blinds does all this for you already
But I wanna do it and perfect some things...
BTW: come to #CodeProject on DalNet (mIRC)
|
|
|
|
|
I have a program where I want an mp3 audio file played in the background at start up and repeated until the program is closed. For now though, I have a menu option which will start the playing of the mp3 (although it will still play in the background without the bar shown)
I added the following function which I got from this program here ( http://www.codeproject.com/audio/mp3player.asp#xx88328xx ), but I can't seem to get it working. I included the vfw.h and put VFW32.lib in the linker's space as well.
When I run this program I get a "memory could not be read" error.
void CChildView::OnPlay()
{
m_Video = NULL;
if(m_Video == NULL)
{
m_Video = MCIWndCreate(this->GetSafeHwnd(),
AfxGetInstanceHandle(),
WS_CHILD | WS_VISIBLE|MCIWNDF_NOMENU, m_Path);
}
else
{
MCIWndHome(m_Video);
}
MCIWndPlay(m_Video);
}
Am I using the wrong function for this or am I simply using the right function wrongly?
|
|
|
|
|
I dunno, but I use the mp3 playback source code in the 'simple skinnable app with mpeg playback' article for this sort of thing, it works a treat.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
I'd already taken a look at that source and it's a lot more involved then what I need.
All I want is to be able to open and play an mp3 in the background, nothing fancy like the skinable mpeg player
|
|
|
|
|
What is the best threadsafe way to get a pointer to an MFC control on a form. I have been trying to use GetDlgItem() and it has not been working. It crashes when it calls isWindow ir something like that. BTW if I call GetDlgItem() from with in the formview class it works fine. I am using MFC7. Thanks.
Steve
|
|
|
|
|
You may be trying to use the returned CWnd pointer before the CWnd has had a chance to Create() itself. This is a common problem when you attempt to access a control using GetDlgItem() in a modeless dialog's OnInitDlg().
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
That is not the case here. The control has definetly been created.
|
|
|
|
|
Maybe I'm misunderstanding you. If you're trying to get at the control from OUTSIDE the formview, you need to call GetDlgItemu() on the formview. For example:
CFormView* pFormView = ...;
CWnd* pCtrl = pFormView->GetDlgItem (IDC_foo);
ASSERT (pCtrl != NULL);
pCtrl->Mumble();
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I'm not sure if there is abest threadsafe way. I never been able to get a pointer to a MFC control like that. Maybe someone can give us more info on that.
You can pass what you need to a function within your formview and let that function call GetDlgItem then update the DlgItem with that information; I'v done this sometimes with int or CStrings. Or make the class that your calling GetDlgItem() from a friend of the formview.
Jay
|
|
|
|
|
GetDlgItem() which returns a CWnd* pointer is an override of the API call
::GetDlgItem(HWND hwnd, UINT control_id) ;
For it to work, you need to have the handle (HWND) of the controls parent window (after all, your getting a dialog item).
It would work for a formview as it is the parent window. If you need to do it from some place else, you would need to get a pointer to the formview first. Something like:
POSITION pos = pDoc->GetFirstViewPosition() ;
CView* pView = pDoc->GetNextView(pos) ;
pView->GetDlgItem(control_id)....
If you were doing this from a worker thread, i have in the past, given it a pointer to the doc whos data it works on, and from there get a pointer to the view (as above) when I needed to update a control. I haven't paid any particular attention to how thread safe it is, but have yet to encounter any problems in this regard.
Roger Allen
Sonork 100.10016
If I'm not breathing, I'm either dead or holding my breath.
|
|
|
|
|
I'm afraid CWnd pointers - as returned by GetDlgItem() - are not thread safe, and cannot therefore be passed across thread boundaries.
Fortunately, the HWND to which the CWnd object is attached can.
What you will probably have to do is use the Platform SDK version of GetDlgItem() to give you the HWND or the control you're interested in, then create a local CWnd object in the thread you need to use it, and call CWnd::Attach() to associate it with the HWND .
Good luck
Andy Metcalfe - Sonardyne International Ltd
Trouble with resource IDs? Try the Resource ID Organiser Add-In for Visual C++
"I would be careful in separating your wierdness, a good quirky weirdness, from the disturbed wierdness of people who take pleasure from PVC sheep with fruit repositories."
- Paul Watson
|
|
|
|
|
Hi every body, I have a program that gets the data from a SQL server, the problem is how can I make a report for any queury or table to print it or view it.
the another thing is : how can i make a setup file for my program?
Best Regards
|
|
|
|
|
http://www.codeproject.com/database/dynamic_odbc_class.asp
would be one way to do this..
hope this helps
bernhard
Sometimes I think the surest sign for intelligent life elsewhere in
the universe is that none of them ever tried to contact us.
|
|
|
|
|
thank u , can I use Crystal Report with VC++?
Best Regards
|
|
|
|
|
crystal what???
i never used it.. i don't even know what this should be..
sorry guy (or girl.. i don't know what sex drawil is)
bernhard
(if you should use ado.. there is a similar tutorial in the ado section)
Sometimes I think the surest sign for intelligent life elsewhere in
the universe is that none of them ever tried to contact us.
|
|
|
|
|
Hi
I'm just wondering whether it is possible to draw both bold and regular text in a CToolTipCtrl.
I want to display a tooltip which looks like this:
----------------
| Button text | <- bold
| |
| some text | <- regular
----------------
how can I do this?
thanks in advance
modified 12-Sep-18 21:01pm.
|
|
|
|
|
int n;
CDatabase db;
db.OpenEx("DRIVER={SQL Server};Server=(local);DATABASE=database1;UID=sa;PWD=123;");
CRecordset rs(&db);
rs.Open(AFX_DB_USE_DEFAULT_TYPE, "select * From table1 where field1="+n+""); //this line error, why?
rs.Close();
db.Close();
//where filed1=variable, how to do that?
//field1 is int type.
|
|
|
|