Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using OCX and avoiding its popup window

Status
Not open for further replies.

MEMDUMP

Programmer
Feb 28, 2005
6
US
I have been using VB6 for several years, but I don't have much experience when it comes to handling dll or ocx (I have copied examples and made them work). I am trying to make a new user interface for a machine to hide all of the "technical stuff" and let my progam do it instead. My problem is when I send the command to the ocx it pops up a window (to open or save a file). How can I have my program step in and select it? (It is ok if the user sees the window)

Just point me in the right direction and I will try to learn the rest.

Thanks.
 
What you say there does not help much, as we don't know what you are doing, what is the OCX you are using, how are you sending the command, what the command is, what is the window that shows up and so on.


SO please give us a LOT MORE detail, including code samples of what causes the window to show up.

All the OCX's I use do NOT show any window, but I could easily create one that does.

Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
Hope this helps.

Ncprog.ocx (not a common ocx)
I added this to the toolbox components and put the prgedt control on form1 and added some buttons to load, save, ect.


Code sample:
Private Sub PRGEDT_WRITE_TO_DISK_Click()
Prgedt1.DoFunction (4) ' write data from edit form to pc disk
End Sub

The DoFunction() handles everything from save, load to cut, paste, find ,ect. Open, save, & find open a new window, but cut & paste don't.

the window looks like a standard open save dialog control.(sorry, I don't know how to add images to post)

is it possible for an ocx to call another ocx or dll (like the common dialog control)?
 
where can we have a look at that Ncprog.ocx?

For what you say it is possible that you are missing some properties/parameters required for those functions.

Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
Ok, first. DLLs don't have a built in UI context, OCXs do. So, if you're making a control (command buttons, listboxes, text boxes, labels, etc.) that's an ocx. If you're not, that's a dll. Sounds to me like you really want to use a dll.

Other than that, your question is too vague for me. What do you mean, send a command to the ocx? What "technical stuff" are you hiding? What do you want the program to do? What's the "it" you want to have your program step in an do instead?

I think I'm going to write an FAQ about making DLLs. If I do, I'll post it to this thread.

Bob
 
Bob,

The way I understood it MEMDUMP is making a wrapper class for an existing OCX that someone else wrote.

The existing OCX pops up a window for user input but MEMDUMP would like to intercept this window and provide the input with code.

Or maybe I misunderstand the question.
 
I wrote mine when there were 0 replies! Sorry for the confusion. Yeah, it's possible for an ocx to call another one, but I believe you're really asking if an existing ocx is written to do this or not, and we don't know. There are probably ways to trap the window using the API, even when it's displayed modally, but I'm not much good with it. Alternatively, you might want to look through your documentation for the control and see if you can set a property or something. Finally, you can build your own activex control, and have it do whatever you want.

For anyone interested, I did write that FAQ, it's at faq708-5940

HTH

Bob
 
Nice FAQ Bob.

However,

"Set CreatePuppy = New Puppy"

I am sure it takes more than that to create a puppy. Don't you know about the birds and the bees? :)

Andy
 
Thanks to all.
I think Sheco understands my problem best. I just searced for info on making a wrapper class and will test that next.

BobRodes, I added your FAQ to my favorites list, very helpful.

I should have stated my original post this way. I have a CNC machine that came with a program (on a w2k PC)for the operator interface(which is very difficult to use). This program uses several ocx files to interface with the CNC hardware installed on the pc. I made a test program using the ocx files and it works, but when I tell the ocx to save/load, the ocx opens a save/open dialog window(i don't have the common dialog control on any form so the ocx must be calling it). I need my program to use this window to select the file. (and a few other windows, but if i can get one to work then the rest should be easy)


 
Well, Andy, of course there's more to it, but all of that detail is encapsulated under the hood, so to speak. That's the beauty of VB, after all. If you want to know more about the birds and the bees, I suggest you take up study of C++.

Regards,

Bob

p. s. Memdump, you might need to be looking at API calls to grab windows, but I'm out of my element here.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top