|
wrote: ...I was hoping that somebody here would know of a good place to start. I would like the tutorial to begin with the basics of VC...
I would suggest Petzold's book.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
wrote: Any suggestions.
Yes, two:- Please update your profile so that it contains a non-empty name. While we love to help, we like to know who we're helping. Thanks.
- See this[^] link. Also see this[^] link when you're ready dive into more complex topics.
/ravi
|
|
|
|
|
|
Okay, Hope I've fixed my name now.. Sorry about that, I made this account awhile back. Thanks for your suggestions everybody, but most of these examples (excluding perhaps the book) seem more like reference material. I was looking around some more and found http://serghei.net/docs/programming/c++/ty%20visualC++6%2021%20days/ewtoc.html[^]
This is what I was more looking for, something that can be followed throughout a set course. Although this seems a tad bit outdated, can anybody comment on if this tutorial is any good, or any more up to date suggestions are more than welcome.
|
|
|
|
|
My existing code is below. A global function which is not a member of any class is calling a function which is a member of class CNewDlg. This code works, but I don't like it. I'm using it because it's the best I have been able to do. I think it can be done better using a user message, but I don't know how user messages work and haven't been able to find any examples. How would I code this using a user message?
void WINAPI HostChange(LinkPtr data) <---global; not in any class. A callback provides ptr data.
{<br />
((CNewDlg*)AfxGetApp()->m_pMainWnd)->LogonChange(data); <br />
}<br />
<br />
void CNewDlg::LogonChange(LinkPtr data) <---function in a dialog class
{<br />
if(data->SomeField == 3){Do something...}<br />
}
|
|
|
|
|
Oliver123 wrote: This code works, but I don't like it.
I'm with you on this!
Here's an ultra-easy alternative, which while not perfect, has its advantages.- Add 2 buttons (
IDC_HOST_CHANGE and IDC_LOGON_CHANGE ) to CNewDlg and make them invisible.
- Write a handler for each - the one for
IDC_HOST_CHANGE should call HostChange() and the one for IDC_LOGON_CHANGE should call LogonChange() .
HostChange() and LogonChange() should get a pointer to an (perhaps the) instance of LinkPtr via a singleton access method exposed by your app class.
- Your static callbacks should post the appropriate message to your app's
AfxGetMainWnd() . No casting to CNewDlg is required. For example:
AfxGetMainWnd()->PostMessage (WM_COMMAND, IDC_HOST_CHANGE);
In lieu of a registered message, this provides a clean separation between event generation by your application's innards and event handling by your application's user interface.
/ravi
|
|
|
|
|
Here's a quick, general introduction to user-defined messages. I'm assuming you're using MFC here.
1. Define a message identifier. You can base it off of WM_USER or WM_APP :
#define WM_MY_MESSAGE (WM_APP + 1)
2. Declare a message handler in your dialog class:
afx_msg LRESULT OnMyMessage(WPARAM wParam,LPARAM lParam);
3. Add an entry to the message map for your dialog class:
BEGIN_MESSAGE_MAP(...)
ON_MESSAGE(WM_MY_MESSAGE,OnMyMessage)
END_MESSAGE_MAP()
4. Define your message handler:
LRESULT MyDialogClass::OnMyMessage(WPARAM wParam,LPARAM lParam)
{
}
5. Finally, send the message when needed:
my_dialog->SendMessage(WM_MY_MESSAGE,
(WPARAM)first_parameter,
(LPARAM)second_parameter);
where first_parameter and second_parameter are whatever values you want to send with the message.
Software Zen: delete this;
|
|
|
|
|
Is there any method to change the shape of the window.
I mean the shape of a window is always rectangular, can be made circular ?
Apurv
|
|
|
|
|
|
Can u plz be more clear, I mean more decriptive.
Apurv
|
|
|
|
|
Its SetWindowRgn .
From the MSDN
This function sets the window region of a window. The window region determines the area within the window where the system permits drawing.
The system does not display any portion of a window that lies outside of the window region.
|
|
|
|
|
|
I saw picture on your profile but I have a question when he stop works and why he never use of mouse
|
|
|
|
|
vc++ 2005
System::Void Form1_Paint(System::Object^ sender, System::Windows::Forms::PaintEventArgs^ e) <br />
{<br />
<br />
System::Drawing::Drawing2D::GraphicsPath ^shape =<br />
gcnew System::Drawing::Drawing2D::GraphicsPath();<br />
<br />
shape->AddEllipse(0, 0, this->Width, this->Height);<br />
<br />
this->Region = gcnew System::Drawing::Region(shape);<br />
<br />
}
|
|
|
|
|
This question is on the Visual C++ / MFC not (Managed) C++/CLI
|
|
|
|
|
I'm confused. What's the difference between these 2 boards ?
What do MFC and CLI mean? Sorry for such a nooobish questions
|
|
|
|
|
|
Hello,
How i can change LocationName property of IWebBrowser2 ?
I try to use GetProperty/PutProperty but it's not works:
BSTR bstrPropName = L"LocationName";
VARIANT varPropValue;
varPropValue.vt=VT_BSTR;
varPropValue.bstrVal=L"this is a test";
m_spWebBrowser->PutProperty(bstrPropName,varPropValue);
it's not return any error but not change LocationName value
Can you give me any example of using GetProperty/PutProperty ?
Thanx for help !
|
|
|
|
|
You are mis-using BSTR . You need to create them properly with SysAllocString() , or use a wrapper class like _bstr_t or CComBSTR .
|
|
|
|
|
What Michael mean by his answer is, you could modify your code like this,
BSTR bstrPropName = SysAllocString(L"LocationName");
VARIANT varPropValue;
varPropValue.vt=VT_BSTR;
varPropValue.bstrVal=SysAllocString(L"this is a test";)
m_spWebBrowser->PutProperty(bstrPropName,varPropValue);
SysFreeString(varPropValue.bstrVal);
SysFreeString(bstrPropName);
|
|
|
|
|
Error msg:
c:\program files (x86)\microsoft visual studio\myprojects\window\winmain.c(44) : error C2275: 'D3DPRESENT_PARAMETERS' : illegal use of this type as an expression
I am not sure what is causing this error. I have the DirectX 9.0 SDK installed. I am using Visual C++ 6.0 and added d3d9.lib and the directory for the include. The only thing different is I have Vista Premium 64 bit version. The windows code works fine. I can't get it to compile DirectX headers? I have also tried it with the free version of Visual c++ 2005 and still getting errors? I have tried running it as an Administrator. Any ideas how to get this working?
D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory( &d3dpp, sizeof(d3dpp) );
d3dpp.Windowed = TRUE;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;
if( FAILED( g_pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd,
D3DCREATE_SOFTWARE_VERTEXPROCESSING,
&d3dpp, &g_pd3dDevice ) ) )
{
return E_FAIL;
}
|
|
|
|
|
The problem is that the D3DPRESENT_PARAMETERS is not defined. Make sure you have included the correct headers in the correct order. Your version of VS will make no difference.
|
|
|
|
|
Hi ,
I have a HDC and I want to convert it to Palette??
So I can get a color table??
How can I do that??
Every new thing you learn,Gives you a new personality.
|
|
|
|
|
dSolariuM wrote: I have a HDC and I want to convert it to Palette??
You cannot convert a DC into a palette. A DC is a container which holds many things for drawing, but it can only hold 1 of each thing at any time. It holds things like pens, fonts, brushes, bitmaps and palettes.
Usually you need to make a palette then select it into the DC. Can you tell me why you need a palette? maybe then I will be able to give you a better solution.
|
|
|
|
|
Hello,
how it is possible to register and then get the message WM_DWMWINDOWMAXIMIZEDCHANGE from system?
"Windows can register to hear about when other windows have been maximized"
I have tried to check for the message ... but I will never get this message ;-(
(Desktop Composition is enabled)
LRESULT CALLBACK wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_DWMWINDOWMAXIMIZEDCHANGE:
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
Thanks,
Regards michi
|
|
|
|