|
Hi Suman
i really appreciate your effort, beleive me there is nothing to feel guilty about if you are unable to understand some code (it also happens to me as well, so no prob ). Atleast you haven't given it up and this should be the spirit, since not failure but low AIM is a crime.
any ways in C++, there are a number of graphics libraries that can be used to render 3D graphs. OpenGl (for example) is a very simple,powerful and easy to use 3d library and inparticular if you use one of its utility called "glut" then just with few lines of code you can draw 3D object in you program. (ya in console program as well )
so if you need any paarticular help about it then i can also do something in it for you since i worked on OpenGL in 2001 ( ya long ago).
wish you best of luck in your BME project
regards
Azam
|
|
|
|
|
Hi Azam,
thanks for ur inspiration. Anyway i am not an easy goin one, so i always feel guilty if i am not getting something which I have to.
I have seen some articles on OpenGL for 3D plots and I am goin thru them and let u know if i need any help in tht.
Meanwhile if u can i am having another task to complete, i.e changing my medical images into BMP format so that I can read them directly. My image files are in *.LL1 and *.LT1 formats. I am having their header info, but i haven't done regarding to header of images reviously, nor i did any format manipulations of images. The interesting thing is i have approached someone at fCoder group of developers, and they r able to convert, but for the source code or exe file they want me to pay $1000... . I have asked them to gimme some step by step procedure how to convert it. I hope they are even not willin to tell tht.
anyway thanks for ur time,
Suman
|
|
|
|
|
Hi Azam,
sorry to bother u again. Here is an article from our code project tht seems interesting to me on 3D plots.
http://www.thecodeproject.com/opengl/ntgraph3d_atl.asp
i am surprised whether it is so easy to implement it. But u know mine is a normal c++ source file, but he says tht inorder to use it we have to have an ActiveX control and then he has given the c++ snippet. Can u tell me how can i change my program to ActiveX control and embed this code into mine. Also i am generating my data in a for loop and i am having x,y,z values (one z value for each iteration) and how can i plot with my values. I will mail him too. But if got some ideas lemme know.
thanks in advance,
Suman
|
|
|
|
|
Hi Suman
There is no need to convert your program into an ActiveX control to use this code. Basically the author has given An ActiveX control, that can be used in our applications, to do this first we have to register the control using following command regsvr32 "C:\NTGraph3D_bin\NTGraph3D.dll" then we can use it in our ( vb,vc) applications (as demostrated by author in NTGraph3D_demo project ).
As far as your senario is concerned you have a plain C++ application, you have two options,
1. either search web for "using activeX control in console based applications".
2. or since the author has given the source of this ActiveX control use the classes created by him in your code.
if you are determined to use this control then do tell me lets see if i can figure out further on the above mentioned options, or if you have some other idea then also share it with me.
ActiveX Controls basically expose some methods and properties that we use to communicate with the control.
regards
Azam
|
|
|
|
|
Hi Azam,
Thanks for ur reply. I finally decidedd to use this control given in our forum. But i am not getting how to use it in my application. Prefer not to say, the demo progams are all greek and latin for me (sorry as a programmer i shouldn't say tht, but actually i am not able to understand). If I can sit for 1 to 2 days on it, i hope i may understand. But, this week i am busy with my midterm exams in other courses and i have to complete this by this friday. So, if u don't mind can u help me out in using this control in my program.
I want just an ActiveX control window showin my 3DSurface plot on it (i mean i don't need all those extra controls tht he has implemented in his demos, just a window with my plot). I hope I am clear. Just tell me how I can use it in my program if I am having 3 coordinates (x,y,z).
sorry, If i am bothering you. But, its urgent for me and I am not having time to go thru those demos in detail.
once again thanks for ur concern,
Suman
|
|
|
|
|
Suman, the problem here is that ActiveX control requires a container to run ( and container should be a CWnd derived class ). I have got an idea, if you donot mind give, give me you code ( i will embed this control in it thruogh some way and will mail it back to you ).
my email address is
muhammadazam_cis08@hotmail.com
regards
Azam
|
|
|
|
|
I opened a Word document using CreateProcess but how do I close or exit the process? I know I need to use ExitProcess(UINT exitcode) but how to I obtain the exitcode. Below is a sample of my code. Thanks!
----------------------------------------------------------------
void OpenFile()
{
char str[300];
DWORD dwExitCode;
STARTUPINFO stStartUpInfo;
PROCESS_INFORMATION pProcessInfo;
memset(&stStartUpInfo, 0, sizeof(STARTUPINFO));
stStartUpInfo.cb = sizeof(STARTUPINFO);
stStartUpInfo.dwFlags = STARTF_USESHOWWINDOW;
stStartUpInfo.wShowWindow = SW_SHOWDEFAULT;
stStartUpInfo.dwXSize = STARTF_USESIZE;
stStartUpInfo.dwYSize = STARTF_USESIZE;
CreateProcess(NULL, str, NULL, NULL, FALSE,NORMAL_PRIORITY_CLASS, NULL,
NULL, &stStartUpInfo, &pProcessInfo);
GetExitCodeProcess(pProcessInfo.hProcess, &dwExitCode);
}
void CloseFile()
{
....code...
ExitProcess(dwExitCode);
}
|
|
|
|
|
After the process is created, you can use pProcessInfo and OpenProcess to obtain a handle to the running process (pProcessInfo.hProcess ). Giving this handle to TerminateProcess will instantly kill the running application. Note that this is the same thing as using CTRL+ALT+DEL on a Windows XP machine: the target process is not notified that it is closing, but is terminated instantly. If you're operating on a Word document to which the user can read, write and save, then using TerminateProcess is a sure way to lose all unsaved work. It will not ask questions or confirmations: it will just kill the process, straight through.
After the process is terminated, GetExitCodeProcess will return the exit code with which the primary thread of the application exited.
Is this what you asked for ?
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Yes, TerminateProcess is what I need to exit the process unconditionally. What I'm really trying to do is parse a word document and pass the values to another child MDI Window for display. The word document gets parsed and opened for viewing via CreateProcess.
Now if the child window was closed and needs to be viewed once again, the user must select that same word document to be re-parsed. It can't parse it when it's already open so I need to close that document and then reopen it for the parsing to work. How can I keep track of all of the word documents that are currently open so that I can close them for re-parsing?
|
|
|
|
|
Hey all, I am having a problem when given a CTempWnd pointer to a deleted window.
I have developed CButton derived class that is supposed to, when clicked, return the input focus to the window that had it before it was clicked. I do this by saving the HWND of the window that is passed into the OnSetFocus() function, and set the focus back to it in the BN_CLICKED message handler.
void COneClickButton::OnSetFocus(CWnd *pOldWnd)
{
CButton::OnSetFocus(pOldWnd);
COneClickButton *pOCB = dynamic_cast<COneClickButton *>(pOldWnd);
m_hFocusFromWnd = *pOCB ? pOCB->m_hFocusFromWnd : *pOldWnd;
}
BOOL COneClickButton::OnClicked()
{
if (IsWindow(m_hFocusFromWnd))
::SetFocus(m_hFocusFromWnd);
else
GetParent()->SetFocus();
return FALSE;
} Ok, that was the easy part. Now comes the fun part that I am having a problem with.
I am using Chris's MFCGrid on a CPropertyPage, with several COneClickButton buttons on the property sheet. The problem comes when the user is editing a cell on the grid and then clicks one of the buttons while the edit window is still open. The CInPlaceEdit class that the grid uses for editing has a feature where by it closes and deletes itself as soon as it loses the input focus, which is all fine and well. But now, when the COneClickButton gets the focus, the pOldWnd pointer points to a now invalid window and the button has no idea where to return the focus. Currently I just set the focus to the property sheet, which passes the focus to the first control on the page. I want the focus to go back to the MFCGrid.
Anybody have any ideas on how to accomplish this, short of handling WM_SETFOCUS messages for every control in my app?
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
The answer is inside the CPropertyPage . This class is derived from CDialog and onwards from CWnd . This inheritance chain will allow access to the GetDlgItem function. Using this function can return a pointer to the requested dialog control's CWnd parent class.
As you are coding the property page, you also have access to the ID specified to the MFCGrid. Thus, you can use GetDlgItem to obtain the CWnd -pointer and call CWnd::SetFocus to set the input focus to the grid. All this should be done only if the handle to the old window is no longer valid (in place of GetParent()->SetFocus() ).
Does this solve it ?
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Antti Keskinen wrote:
Does this solve it ?
Yes and no. It sounds like it will work, I will give it try. But it is not very OOP. It will require the COneClickButton knowing all about the property sheet it is on, the pages that are on the sheet, and the grids that are on the pages. I was hoping to there was a way that it could be done without the COneClickButton knowing all that stuff.
Thanks for the pointer, I am now further along then I was before.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
If you had a normal Windows control, it would always have the HWND of the parent window. Thus, getting this HWND and enumerating the child windows would return the control itself at some point.
The COneClickButton is a similar case: it is an MFC control (I presume), thus it needs to be derived from CWnd. In this case, it has the GetParent function, which allows it to get a pointer to the parent's CWnd class.
The most object-oriented way (I think) would be to first use GetParent to get the parent window (property page) and then use EnumChildWindows to query through all children of this page, looking for one which has the same class name as the grid control.
I don't think there is a more object oriented way than that without breaking the way Windows works.. Or at least, I'm not aware of one if there is..
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Hello,
I am developing a database application. The database will be on a server, but I would like to be able to allow viewing and editing while not on the network. Lotus Notes does this, and probably other applications.
Any suggestions as to how to implement this? Should I keep a record of all changes to individual fields and records as the user makes changes and then process them onto the network database when the user is connected again?
Regards,
Ted
|
|
|
|
|
|
Hi, I have two windows processes and one sends (posts) a mesage to the other to activate it etc. When the main app gets this message it calls SetForegroundWindow() to bring the app to the foreground so it is the active/on top application.
The problem is SetForegroundWindow() is failing (returning 0) and my app stays in the background. I've also tried BringWindowToTop().
The WinXP Task Bar flashes the Icon for my app.
I'm going nuts here.
Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
|
|
|
|
|
That's how XP works. It flashes the taskbar instead of having the application take over the screen. If you can, try your App. on a Win 98 machine just to make sure it's XP and not your code.
|
|
|
|
|
|
|
Well my initial hopes have been dashed. It appears to work when I run the App in the Debugger, but not otherwise.
I think the problem is the first app is stealing back or not relinquishing focus. I have another path I'm about to head down.
I use SetForegroundWindow() at other times in the App to restore from the System Tray for example and they work fine.
Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
|
|
|
|
|
|
Hi Scott,
Thanks for that. I'd never heard of SwitchToThisWindow().
This sort of works, however there are two problems. First the Task Bar pops-up (I have it to Auto-Hide) and flashes the app icon. Second and worse is if I Alt+Tab to another app afer my app has come to the foreground using SwitchToThisWindow() then cause my app to activate using SwitchToThisWindow() the aforementioned app is activated not mine. This is a killer.
Finally SwitchToThisWindow sends the previous app to the bottom of the Z-Order which seems very strange. AFAIK this isn't what SetForegroundWindow() does.
I can't believe something as simple as this is causing me so much grief.
Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
|
|
|
|
|
As others have said this is the way XP is supposed to work; users don't like have the rug window they are working in being pulled away without warning. However, if you are certain you have a really good reason to do it (warning of an impending nuclear strike or the re-election of Dubbya), you can (usually) do it this way:
BOOL StealFocus(CWnd *pWnd)
{
DWORD ForeGroundID = GetWindowThreadProcessId(::GetForegroundWindow(), NULL);
DWORD CurrentID = GetCurrentThreadId();
BOOL bRet = AttachThreadInput(ForeGroundID, CurrentID, TRUE);
pWnd->SetForegroundWindow();
pWnd->SetFocus();
AttachThreadInput(ForeGroundID, CurrentID, FALSE);
return bRet;
}
The opinions expressed in this communication do not necessarily represent those of the author (especially if you find them impolite, discourteous or inflammatory).
|
|
|
|
|
Hi Phil,
Thanks for the reply. I couldn't get this to work reliably either as indicated in an earlier reply. It worked in the debugger, but not outside.
Both of these apps are mine, so I just need the ability to get one to bring the other to the foreground. I've read up on all the issues and what MS is trying to do and why and I'm basically ok with that. But in my case I'm not pulling any rugs out from under anyone but myself.;)
I have a solution which seems to work, but I'm not as happy as I'd like with it. I'm about to try doing the SetForgroundWindow() in in App A to get it to bring App B to the foreground and my understanding is this should work. Up untill now I was trying to get App B to bring itself to the foreground.
This is the start of a new day for me (here in Oz) which I hope will be better than yesterday.
Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
|
|
|
|
|
It works fine for me in and out of the debugger as a way for an application to bring itself to the foreground. I simply have StealFocus(this) in a dialog that shows a vital message.
The opinions expressed in this communication do not necessarily represent those of the author (especially if you find them impolite, discourteous or inflammatory).
|
|
|
|
|