|
I'm doing an application that will allow users to modify 3d cars.
We are currently planning on useing a MFC application but have ran into a few problems. I was wondering if you could give me some advice on this:
I can't really figure out what type of MFC application to use.
Getting all of the widgets and GUI elements to work arn't a problem if we use a MFC Dialog Based application. However the problem with this is we can't seem to get a Menu working in a dialog based application and
Another problem is we need to be able to render real time 3d in directx 9. I was able to make a MFC SDI Based application that integrates the Directx 9.0 API into MFC and can render 3d in real time. But this is a simple black and white screen with no GUI Widgets.
Is there anyway i can combine these two types of MFC applications? Do you know how i could get a menu in MFC Dialog based app? Lastly is it possible to get a MFC SDI window displayed in a MFC Dialog.
Any advice or info would be greatly appreciated.
|
|
|
|
|
Warning! Shameless self-plug ahead!!
I recently published an article here that may help you out: A 3D-Enabled View Base Class for SDI Direct3D Development[^].
It's a CView-derived class specifically for Direct3D rendering in an SDI environment. Since it's designed for SDI apps, you'll have full use of all the MFC widgets, gidgets, and gadgets. It's written to DirectX 8.0 spec, but it's a small class, and only some minor changes would need to be made to convert it use the Direct3D 9.0 interface instead of 8.0.
Bob Ciora
|
|
|
|
|
"I was able to make a MFC SDI Based application that integrates the Directx 9.0 API into MFC and can render 3d in real time. But this is a simple black and white screen with no GUI Widgets."
Thats not the problem. I have a MFC SDI directx window program. The problem is takeing that really basic looking window and wrapping a dialog around it with nice gui features. Do you see my problem? I can do directx in a basic window and i can do nice gui in a dialog window but i can't do both... any ideas?
|
|
|
|
|
Ahh, my apologies. I was under the impression that, although you managed to integrate Direct3D with SDI, but couldn't get any of the other widgets or menus working with that (re: your comment about the simple black and white screen). The goal of the class in the article was to provide a CView-derived base class that you can inherit your own View class from and not have to worry about piecing in the DirectX "guts." The 3D support is built in to provide the basis for an SDI application.
Ok, so to clarify the problem, then....is your goal to have a 3D Dialog-based application? Or to have both a window and a dialog rendering 3D at the same time?
For the dialog, this may work (I'm going to try it out myself to check it). How about adding an empty control that encompasses the area within the dialog in which you want to render the 3D? The control is there only as an "anchor" to provide a window to attach Direct3D, since you need an HWND to initialize Direct3D. You can use a simple "static text" control. I'm thinking that you may have to configure it as "transparent" under the control's "Properties".
In your OnInitDialog , then, you can access the control with GetDlgItem . This returns the generic CWnd pointer for the "anchor" item. You can then use the HWND from that control to initialize DirectX within the Dialog. From there on, you should be able to do all of your rendering and presentation.
Also, you mentioned trouble with the Dialog's menus. What sort of trouble were you having? The statement is a bit hazy
Just bouncing ideas
Bob Ciora
|
|
|
|
|
Ok, here's how I got this to work in the dialog:
1. As I mentioned, create some dummy control, a static text box, for example. Size this control within the dialog editor to the place where you want the 3D rendering to occur. Give it an ID that you can remember. For demo purpose, I used IDC_3DANCHOR . In the example below, I used a Static Text control so I can display errors if 3D initialization fails.
2. Declare a CWnd as a member variable of your dialog, e.g. CWnd m_wnd3D (as used in the examples below). This is the actual window to which 3D will be rendered.
3. In OnInitDialog , do the following (after the call to CDialog::OnInitDialog ):
CWnd * pAnchor = GetDlgItem(IDC_3DANCHOR);
RECT rectAnchor;
pAnchor->GetWindowRect(&rectAnchor);
ScreenToClient(&rectAnchor);
if( !m_wnd3D.Create( NULL, "", WS_VISIBLE, rectAnchor,
this, ID_3DWINDOW, NULL ) )
{
pAnchor->SetWindowText("Failed creating anchor window");
}
Note that you'll have to explicitly define ID_3DWINDOW in your resource file. But that's easy enough. The Create call will build your (future) rendering window, and position it within the dialog exactly over the Control that you're using as the anchor (IDC_3DANCHOR in this case). Passing this as the fifth parameter makes the window a child of the dialog.
4. After that, do the normal 3D initialization...get the IDirect3D interface, get the desktop format from the current display mode, and use that to create the device:
HRESULT hResult =
m_pDirect3D->GetAdapterDisplayMode(0, &m_d3dDisplayMode);
if( hResult != S_OK )
{
pAnchor->SetWindowText("Failed getting adapter display mode");
return TRUE;
}
memset(&m_d3dPresentParams, 0, sizeof(D3DPRESENT_PARAMETERS));
m_d3dPresentParams.Windowed = TRUE;
m_d3dPresentParams.hDeviceWindow = m_wnd3D;
m_d3dPresentParams.BackBufferFormat = m_d3dDisplayMode.Format;
m_d3dPresentParams.SwapEffect = D3DSWAPEFFECT_COPY_VSYNC;
m_d3dPresentParams.EnableAutoDepthStencil = TRUE;
m_d3dPresentParams.AutoDepthStencilFormat = D3DFMT_D16;
hResult = m_pDirect3D->CreateDevice(
0, D3DDEVTYPE_HAL,
m_wnd3D,
D3DCREATE_HARDWARE_VERTEXPROCESSING,
&m_d3dPresentParams,
&m_p3DDevice );
if( hResult != S_OK )
{
pAnchor->SetWindowText("Failed creating 3D Device");
return TRUE;
}
5. If this was all successful, then the final step is to make sure that the original control you used as an anchor remains hidden:
pAnchor->ShowWindow(SW_HIDE);
6. OnPaint , then, is where you'd perform all of your rendering.
You'll probably want to consider adding OnSize handling in the event that the dialog gets resized, etc. etc.
But this sequence works just fine. In fact, if you know exactly where you want to put your 3D mini-view within the dialog, you don't really need the "anchor" control. I just included it since it's easier to manipulate its size in the dialog editor and just use the GetWindowRect call.
Oh, one other issue....if you're rendering to a Dialog and a View at the same time, you may want to look into Swap Chains. Just more fun Direct3D reading
Hope it helps!
Bob Ciora
|
|
|
|
|
Thanks a ton for the help but i'm stuck on #3
"Note that you'll have to explicitly define ID_3DWINDOW in your resource file. But that's easy enough. The Create call will build your (future) rendering window, and position it within the dialog exactly over the Control that you're using as the anchor (IDC_3DANCHOR in this case). Passing this as the fifth parameter makes the window a child of the dialog."
what exactly will the ID_3DWINDOW be? How do i make one in my resource file?
Also when i say i can't get menus in a dialog box i mean the MFC menu with File,Edit...ect at the top of the screen.
thanks again!
|
|
|
|
|
When you create the dialog in the resource editor, in the Dialog's properties, there's a drop down list to specify a menu resource to add to the dialog. Create the menu you want to use with the dialog in the resource editor, and just use that menu's IDR_xxx code in the Dialog's properties window.
As for creating the ID value for the window, you can do that in the Resources tab of the Workspace pane in Visual Studio. On the outermost folder there, the one with "(your app) Resources", right click on that. A popup menu will appear. Select "Resource Symbols" and you can define a new symbol name there. It will automatically assign a new value for the symbol, so you don't have to worry about which value to use.
Bob Ciora
|
|
|
|
|
Have a look at CDialogBar. It allows you to dock a dialog to a mainframe window and the docking location can be any of the CBRS_TOP family locations. You can also have multiple dialogs docked for example one on the left side and one on top.
I believe there are samples that use it on MSDN.
|
|
|
|
|
That one looks like it might do the trick, too. At least the "dialog" is tied directly more closely to the application in this case.
For this particular problem, if it's DirectX 9, I found this, too:
DirectX AppWizard[^]
Looks like you can create a 3D-enabled dialog app there, too
Bob Ciora
|
|
|
|
|
I'm working with VS studio.net so i'll either have to hunt down a copy of VS 6.0 or keep working with your first idea.
I'm at step 4 and i'm getting the error:
error C2065: 'm_pDirect3D' : undeclared identifier
What include do i need for this? I tried d3d8.h and d3d9.h as i have the Directx 9.0 sdk on the pc.
Also i made a menu in resource view and gave it an id of menu. However when i click on my dialog resource i can't find any sort of drop box or place to include the menu id. I'm useing visual studio.net. Can you be more specific?
Thanks again.
|
|
|
|
|
The m_ variables were defined in the header file for that dialog. Here are the declarations:
LPDIRECT3D8 m_pDirect3D;
D3DDISPLAYMODE m_d3dDisplayMode;
D3DPRESENT_PARAMETERS m_d3dPresentParams;
LPDIRECT3DDEVICE8 m_p3DDevice;
HRESULT m_hDeviceState;
D3DXCOLOR m_cClearColor;
D3DVIEWPORT8 m_Viewport;
CWnd m_wnd3D;
I only have the DirectX 8.0 toolkit, so you'll want to make these be DirectX 9 references (although DX8 stuff should work with DX9).
Bob Ciora
|
|
|
|
|
I inluded "d3dx8.h" and declared your variables in the dialog.h. It compiles ok but when it runs i get the windows xp "report error screen" that says:
"TODO: has encountered a problem and needs to close. We are sorry for the inconvenience."
and the program won't run. Do you think this is because i have the directx9 sdk? or mabye because i'm using .net? In any case i really don't know much about directx i just need this window included in my application so someone can implement it later.
I migt just want up finding a copy of VS studio 6.0 so i can use the directx wizard and make a dialog app. I was really hopeing your steps would work for me any ideas? I have two other questions
#1 I made a menu in resource view and gave it an id of menu. However when i click on my dialog resource i can't find any sort of drop box or place to include the menu id. I'm useing visual studio.net. Can you be more specific?
#2 You told me: "You'll probably want to consider adding OnSize handling in the event that the dialog gets resized, etc. etc." Do you have sample code on how to do this? I would really like my application to have the ability to maximize and re-size.
thanks much!
|
|
|
|
|
I wanna write the app that control CD Player using hot key
and lock some keystrokes by Hook.
Ex: Ctrl + P :Play,Pause, Ctrl + E :Eject/Insert CD....
Can you guide me some steps to begin ?
ThkU...
NewTan
|
|
|
|
|
Why I was rejected so much with following resume ?
I find job in My native country, in town where I live.
Not Us and England, but sometimes this companies - outsource US, England.
After inviting to interview and speaking, usually very friendly,
technically,
getting "ok" on appropriate question about resume skills and around....
Why I was rejected so much with following resume ?
Explain me please. What is mostly probably bad ?
thanks you.
________________________________________
My Name
PROGRAMMING RESUME:
OBJECTIVE:
To find a position as a programmer.
in a field C++, MFC ATL, DCOM, DBMS,XML, Client/Server 2,3 tier, LAN/Internet programming.
EXPERIENCE SUMMARY:
- 8 years of programming experience
- Microsoft Visual C++ 7.1, MFC, ATL, DCOM,
- C#, .NET.
- DHTML, JScript, XML/XSL
- developing: COM ,ActiveX, COM+, ASP
- ActiveX scripting.
- DBMS : Microsoft SQL Server 2000, ODBC, OLE DB, ADO
- Sockets programming
- Threading programming.
- UML
Microsoft Certification:
MCSD exam 70-015 "Designing and Implementing 'Distributed' Applications with
Microsoft Visual C++ 6.0". (exam purpose: - Fast and efficient work, good projects architecturing. - prove,
in COM, DB, MTS, threading, GUI programming and around.)
SCORE - 860 for 540 pass of 1000 total.
Now writing application using: Java, J2EE, CORBA, RMI, Servlet, Applet, JSP, - as component technologies,
design patterns and SWING, AWT - GUI technologies.
EDUCATION:
1987 - 1994 MS in Electronics Engineering.
Applied Mathematics and Physics specialty.
Moscow Institute of Physics and Techniques. Russia
EMPLOYMENT HISTORY:
07.2002-10.2004 Arktika, lead programmer, C++, ATL, COM, OLE DB, developing ActiveX. GUI: MFC, Win32.
System of data gathering, analyzing, technology lines visualization and management, project organizing.
WinNT share/NT security handling project, using ADSI, WMI, win32 security.
Win32 Processes management utility, threaded scheduler components.
10.2001-5.2002 DiscussData Solutions(US), programmer,
Provided system of COM objects to customize applications with ActiveX scripting technology
and its Databases integration. Using C++, COM, OLE DB, ActiveX scripting.
Creating system of scripting COM objects,
that extends initial system to user customized,
with database connectivity and user data supplied structures
as infrastructure.
2001 Ulter Systems(England company), programmer for COM, MS SQL server.
Provided COM subsystems for TV ratings calculation program for ASP subsystem.
Using C++, COM,
Creation of COM objects that comply all conventions from
custom library systems.
1998 -1998 Position in Commercial corporation "AvtoContract"
Moscow, Russia
position: Senior Programmer.
-Windows GUI programming and design, developing ActiveX control elements.
- Provided design, coding, and project management of developing for
Subsystem For Company's Trade data management system:
Integrating MS SQL Server with MS Office programs and special national trade software products on the base of OLE Automation Technology,
Programming OLE servers with Some Business logic and DBMS components.
- 2,3-Tiered Client/Server systems for company's product
management system. Based on COM, ODBC, MS ADO, OLE DB.
(please note that above is a most preferable specializations)
Visual ActiveX with database connectivity:
extending existed systems to connection to other databases,
than was available,
and supplying new visual functionality, some controls
is created as 3 tier, having separate business logic,
fully complying to Microsoft DNA.
Creating RAD for structured DB visual connectivity to GUI,
using DNA layers. Like BizTalk framework.
Creation for MFC "behaviors" - reusable components for fast creation and organizing
visual forms. COM based.
1994-2001
Institute of Microelectronics Problems. Chernogolovka, Moscow dist.
Russia.
position: programming engineer.
- 1996-1997
- Provided design, coding, and project management of developing
Workgroup resources counting program at laboratory level,
using finally MS Visual C++ 5.0, ODBC , ACCESS, OLE,
Many windows database application with many
accounting ways, using some ActiveX controls.
WinSock Technology:
Developing connection between devices with PC in many laboratories.
PERSONAL DATA:
34 years old, Single
FOREIGN LANGUAGES:
Fluent English
HOBBIES:
Sports, Computers, Literature
REFEREE & REFERENCES
May be presented additionally .
CONTACT:
E-mail: du_volon@fromru.com
|
|
|
|
|
If you're looking for a job in the U.S. or in England (or any other English speaking country), you may want to have a friend do a bit of rewriting so that it's a bit more understandable. I'm sure that much of the original formatting was lost as well, though, so it's hard to tell what's bulleted and what isn't.
With 8 years of experience, you may want to expand more on the things you've done, and eliminate personal information such as age, marital status, and hobbies.
In any event, that's what I can think of off the top of my head. But look at the bright side: at least you're getting interviews. The tech bubble is well past popped, and it's a buyers market now. There are more programmers than jobs, and lots of companies are getting hundreds of resumes for a single position. Consider yourself lucky that you're at least getting in the door.
Bob Ciora
|
|
|
|
|
I find job in My native country, in town where I live.
Not Us and England, but sometimes this companies - outsource US, England.
|
|
|
|
|
I think what Bob Ciora trying to say is the expected salary figure is the reason that drive the decision and might not be your resume or experience.
Or suppose Russia has too many good programmers that drive the competition crazy?
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
SALARY:
AS I said: I much job offer skills for 80-100%,
confirm it usually, for 80-100%,
much salary offer for it precisely.
get after interview words "we like you, wait days"
and no responce - means reject.
Up to now useful - to eliminate hobies. I can delete it easily.
But many employers has such a line in resue form.
Some products is big enough, thus creating one per year in average is not a good
result ?
I written many small utilities- must I include description of it -
does not my esume will be too much, and technology repetitive ?
But is it only disadvantages you found ?
Other is perfect ?
Big thanks for brainy help.
|
|
|
|
|
I'm trying to use this to figure out this problem:
1abc x 4 = de52 The letters a, b, c, d, e each represents a digit in the range 1-9. No digit can be used twice. 1, 5, 2, are already used.
Just wondering if any of you have good ideas of how to get the answer. Below is some of the code I started to write for it.
#include<iostream>
using namespace std;
bool checkSolution(int,int,int,int,int);//
void display(int,int,int,int,intmain()
{
int a,b,c,d,e;
int count=0, checkR=0;
for (int a=3; a<9; a++)
{
if (a > 9 || a==5 || a==4 ) continue;
for (int b=3; b<9; b++)
{
if (b > 9 || b==5 || b==4) continue;
for (int c=3; c<9; c++)
{
if (c > 9 || c==5 || c==4) continue;
for (int d=3; d<9; d++)
{
if (d >= 9 || d==5 || d==4) continue;
for (int e=3; e<9; e++)
{
if (e >= 9 || e==5 || e==4) continue;
if (a!=b && a!=c && a!=d && a!=e)
{
count++;
break;
}
checkR=checkSolution(a,b,c,d,e);
if (checkR==1);
display(a,b,c,d,e);
}
}
}
}
}
}// end of main
bool checkSolution(int a, int b, int c, int d, int e)
{
if ((a!=b && a!=c && a!=d && a!=e) && ((1+a+b+c)*4==(d+e+52)))
return 1; // temporary return so sample will compile
else
return 0;
}
void display(int a, int b, int c, int d, int e)
{
cout << "1" << a << b << c << "\n";
}
|
|
|
|
|
Hey now! You should be paying people to do your homework
Seriously, though, your logic is flawed:
1abc x 4 = de52
Actually resolves to:
(1000 + 100*a + 10*b + c) * 4 = 1000*d + 100*e + 52
or (factoring out the 4):
1000 + 100*a + 10*b + c = 250*d + 25*e + 13;
or (rearranging terms):
100*a + 10*b + c - 250*d + 25*e + 987 = 0
You know that a, b, c, d, and e can only be single digits in the set {3,6,7,8,9}. So try to come up with a solution, using this simple 5-entry array, as your basis.
From there, you're on your own :p
Bob Ciora
|
|
|
|
|
I'm looking to try and thread this program I've been working on so it won't hog the system when files are open and analyzed. I think I understand threads but I am looking for a (free) program that might look at my program and tell me where the most resources are used, memory, CPU and disk so I can focus the thread usage on those. I was told about something like that for Unix (forgot the name) so I'm sure there's something, I just can't seem to find it. Thanks in advance, Nathan.
|
|
|
|
|
I found This Article[^] right here on CodeProject. It seems to be a Profiler (which is the type of tool you're looking for). From the screenshot that comes with the article, there looks to be a "Threads" column, but I can only see the "T" and half of the "h"
It might be worth a look. And like everything here...it's free!
Bob Ciora
|
|
|
|
|
ah, good call, I was probably using the wrong search terms, many thanks.
|
|
|
|
|
No worries Glad to help. I guess I should've mentioned that a Profiler is what you were looking for.
Bob Ciora
|
|
|
|
|
I have found how to use the Link mask to make text act like an internal hyperlink. The linked text is underlined and colored to resemble a hyperlink. I am trying to remove both the underline and coloring to hide the link until it is hovered over. Is there a way to do this?
Thanks.
|
|
|
|
|