The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum
 Origin Forum
 Handle of the window

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
jonni Posted - 11/26/2003 : 12:54:02 PM
I want to create and place my own visual component, for example, on the graph window. In order to do it i have to know a Handle of the graph window.
basically I want to use API call: SetParent(myhandel,Graphhandle)

is it possible to do it?
or any other ways to achive this?

is it possible to use from OriginC API functions?
(for example RegisterClasseEx,CreateWindowsEx,SetParent: i'm still going into creating my own visual component on the grap window :) )
8   L A T E S T    R E P L I E S    (Newest First)
cpyang Posted - 11/26/2003 : 4:03:39 PM
I don't think you can directly include a huge header like windows.h, since it include many many other headers and they all need to be found and there are probably things not compatible in Origin C.

You will need to add the needed protypes into a header that will provide needed functions. For example, to use FindWindow, you need

#pragma dll(user32, system)
#define FindWindow FindWindowA
HWND WINAPI FindWindowA(LPCSTR lpClassName , LPCSTR lpWindowName);

and put above into a separate header file.
The above information can be found in WinUser.h from VC.


CP


jonni Posted - 11/26/2003 : 3:47:54 PM
1. --------------------

i have windows.h

#include<windows.h>
I want to use API calls declared in this file.

Origin7 SP4:
can compile in originC with this include and have access to all functiuons, but can not to run anything (even empti void Test() {} : CommandError) it happened after installing SP4

Origin7.5:
can not even compile... problem with syntax error in procompile #if , #endif....

2. --------------------
void Test()
{
#pragma dll(user32, system)
FindWindow("Class",NULL);
}

Compilation: the function FindWindow is not found :( but it is defined in user32.dll

trying to use #include <winuser.h> where the function FindWindow is declared...
a lot of problem during compilation

is any mistakes in my code??
cpyang Posted - 11/26/2003 : 3:41:35 PM
Probably PostMessage not implemented in 70SR4, but you don't need that anyway, just to show that you can get the correct handle to a window.

CP


jonni Posted - 11/26/2003 : 2:25:41 PM
ok... I updated My Origin to the 70SR4

now i can compile your code without problem

but when I try to run it: Command Error!

I did absolytelly the same in Origin7.5 evalution just to test and it works fine.



Edited by - jonni on 11/26/2003 2:25:59 PM
cpyang Posted - 11/26/2003 : 1:56:25 PM
Which version of Origin are you using? Can you look into mswin.h in system folder? The method should be introduced in 70SR4, and certainly in Origin7.5.

If you need call other API, best would be to create your own header and add the needed #define and prototypes as you see fit. You can look at mswin.h to see how it was done. You can search for

#pragma dll(kernel32, system)
#pragma dll(User32, system)


CP




jonni Posted - 11/26/2003 : 1:28:35 PM
Dear cpyang,

Porblems :(

I tried to do what you suggested

error during compilation
GraphPage::GetWindow() not defined or does not have matching prototype

what to do?
jonni Posted - 11/26/2003 : 1:19:43 PM
thanks a lot, almost what I wanted..
will tray.

how about using API functions in OriginC programming?
is it possible just include windows.h, messages.h (i need just 2 of that *.h files)?
cpyang Posted - 11/26/2003 : 1:10:16 PM
If you just want to have access to the window handle of an Origin graph, the following will show you how to Post a message to a given graph window,




// following const not yet defined in Origin C
#define WM_SYSCOMMAND 0x0112
#define SC_MINIMIZE 0xF020

void Test(string strGraphWinName = "Graph1")
{
GraphPage gp(strGraphWinName);
if(gp)
{
HANDLE hWnd = gp.GetWindow().GetSafeHwnd();
if(hWnd)
{
MessageBox(hWnd, strGraphWinName + " will be minimized next", "Hello World", MB_OK);
Window wnd(hWnd);
wnd.PostMessage(WM_SYSCOMMAND, SC_MINIMIZE);
}
}
}




The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000