|
I think (and this might be widely inaccurate in your case) that process control is a general term for controlling hardware processes (like keeping the waterlevel in a tank between some predefined min and max).
I suppose you could use/extend the MSComm ActiveX control to handle the specific hardware you are using...
/moliate
|
|
|
|
|
I used to be able to do things like the following in the VB6 immediate window:
set doc = CreateObject("Microsoft.XMLDOM")
Does anyone know how I can do this VS.NET now that all the development environments have been combined?
Cheers,
Tom Archer
Author, Inside C#
|
|
|
|
|
Although I haven't tried setting a variable to an instance of a COM object, this seems to work (I've tried an Object type and set it to 1 and "asdf" successfully):
For some strange reason I'm thinking you can find your way to the command window so I'll skip that part In the command window type "immed" to switch to immediate mode (type ">cmd" to switch back to command mode). Once you're in immediate mode you can manipulate variables like you used to in VB6. This also seems to work in C#, but for some reason you have to set the variable twice in the command window for the assignment to stick....
Andy Gaskell, MCSD
|
|
|
|
|
Uh, no. The debugger is the same as C#'s, and doing something like that would imply edit-and-continue, which is not supported.
___________
Klaus
[www.vbbox.com]
|
|
|
|
|
Heres one for you.
How do you force a modal form to show up in the taskbar.
E.g.
You have a bog basic VB Form named Form1 and a Sub Main which looks like this.
Public Sub Main
Form1.Show vbModal
End Sub
The fact that the form is modal means that it doesn;t show up on the taskbar. I need it to show up on the task bar. Any ideas? API Welcome!
Cheers
Pete
|
|
|
|
|
If its the first form you are showing, then you dont need to make it modal. Just remove "vbModal" from your line.
--
David Wengier
|
|
|
|
|
This is obviously just a piece of test code. You dont think I'd leave a form named "Form1" in a real project do you?
Think of it as a puzzel. You have this information and need this result. What do you do?
Thanks for your answer.
Pete
|
|
|
|
|
Pete Bassett wrote:
You dont think I'd leave a form named "Form1" in a real project do you?
I've seen worse, and I dont like to assume anything about the knowledge people on forums have.
But, the question you asked, I answered correctly. For the answer to the question you should have asked, and meant, I shall post in a reply to this, as it is rather long.
There are probably other ways of doing this, but I use this method as it means I can just drop the module into my apps, and call the HookAttach method as necessary, whenever I want to give something a taskbar button
--
David Wengier
Sonork ID: 100.14177 - Ch00k
|
|
|
|
|
Okay, long code:
Firstly, usage. Call the HookAttach function before loading and showing your form, as it catches the WM_CREATE message. Call HookDetach when you want to stop it catching forms. A good place for this is in the child form.
Now, the code. Put this in a standard module:
Option Explicit
Private Type CWPSTRUCT
lParam As Long
wParam As Long
message As Long
hwnd As Long
End Type
Private Type CREATESTRUCT
lpCreateParams As Long
hInstance As Long
hMenu As Long
hWndParent As Long
cy As Long
cx As Long
y As Long
x As Long
style As Long
lpszName As Long ' String
lpszClass As Long ' String
ExStyle As Long
End Type
Private Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal ncode As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook As Long, ByVal lpfn As Long, ByVal hmod As Long, ByVal dwThreadId As Long) As Long
Private Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long
Private Const WH_CALLWNDPROC = 4
Private Const WS_EX_APPWINDOW = &H40000
Private Const WS_EX_TOOLWINDOW = &H80&
' VB5 & VB6 class names:
Private Const C_MDIFORMCLASS_IDE = "ThunderMDIForm"
Private Const C_MDIFORMCLASS_EXE = "ThunderRT6MDIForm"
Private Const C_MDIFORMCLASS5_IDE = "ThunderMDIForm"
Private Const C_MDIFORMCLASS5_EXE = "ThunderRT5MDIForm"
Private Const C_FORMCLASS_IDE_DC = "ThunderFormDC"
Private Const C_FORMCLASS_EXE_DC = "ThunderRT6FormDC"
Private Const C_FORMCLASS_IDE = "ThunderForm"
Private Const C_FORMCLASS_EXE = "ThunderRT6Form"
Private Const C_FORMCLASS5_IDE = "ThunderForm"
Private Const C_FORMCLASS5_EXE = "ThunderRT5Form"
Private m_hHook As Long
Private m_lHookWndProc As Long
<BR><BR>
Private Function Form_WndProc(ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Dim lSetStyleEX As Long
' SPM - specific wnd proc for a form. Only called once for the WM_CREATE message.
Select Case Msg
Case WM_CREATE
Dim tCS As CREATESTRUCT
CopyMemory tCS, ByVal lParam, Len(tCS)
lSetStyleEX = GetWindowLong(hwnd, GWL_EXSTYLE)
lSetStyleEX = lSetStyleEX Or WS_EX_APPWINDOW
lSetStyleEX = lSetStyleEX And (Not WS_EX_TOOLWINDOW)
tCS.ExStyle = lSetStyleEX
CopyMemory ByVal lParam, tCS, Len(tCS)
SetWindowLong hwnd, GWL_WNDPROC, m_lHookWndProc
SetWindowLong hwnd, GWL_EXSTYLE, tCS.ExStyle
End Select
Form_WndProc = CallWindowProc(m_lHookWndProc, hwnd, Msg, wParam, lParam)
End Function
<BR><BR>
Private Function AppHook(ByVal idHook As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Dim CWP As CWPSTRUCT
Dim k As Long, aClass As String
If idHook >= 0 Then
CopyMemory CWP, ByVal lParam, Len(CWP)
Select Case CWP.message
Case WM_CREATE
aClass = Space$(128)
k = GetClassName(CWP.hwnd, ByVal aClass, 128)
aClass = Left$(aClass, k)
If IsIn(aClass, C_MDIFORMCLASS_IDE, C_MDIFORMCLASS_EXE, C_MDIFORMCLASS5_IDE, _
C_MDIFORMCLASS5_EXE, C_FORMCLASS_IDE_DC, C_FORMCLASS_EXE_DC, C_FORMCLASS_IDE, _
C_FORMCLASS_EXE, C_FORMCLASS5_IDE, C_FORMCLASS5_EXE) Then
m_lHookWndProc = SetWindowLong(CWP.hwnd, GWL_WNDPROC, AddressOf Form_WndProc)
End If
End Select
End If
AppHook = CallNextHookEx(m_hHook, idHook, wParam, ByVal lParam)
End Function
<BR><BR>
Private Function IsIn(ByVal vComp As Variant, ParamArray vTo() As Variant) As Boolean
Dim i As Long, iL As Long, iU As Long
On Error Resume Next
iU = UBound(vTo)
If Err.Number = 0 Then
iL = LBound(vTo)
For i = iL To iU
If vComp = vTo(i) Then
IsIn = True
Exit Function
End If
Next i
End If
End Function
<BR><BR>
Public Sub HookAttach()
m_hHook = SetWindowsHookEx(WH_CALLWNDPROC, AddressOf AppHook, App.hInstance, App.ThreadID)
End Sub
<BR><BR>
Public Sub HookDetach()
If m_hHook <> 0 Then
UnhookWindowsHookEx m_hHook
m_hHook = 0
End If
End Sub
--
David Wengier
Sonork ID: 100.14177 - Ch00k
|
|
|
|
|
|
Nice looking code there David. Unfortunatly it crashes pretty bad. Takes VB down with it. I put the Hook call before the Form1.Show vbmodal and the unhook call after.
It just shuts down vb.
Any other ideas? Maybe you could email me your working example?
Thanks again.
Pete
|
|
|
|
|
Interesting. Aside from adding the few API declerations I forgot (I am too used to win.tlb these days) it worked fine.
Email is on its way
--
David Wengier
Sonork ID: 100.14177 - Ch00k
|
|
|
|
|
Fellow Programmers,
I am in the process of starting a new project on the development of condition based maintenance tool. I need some directions from any one of you out there. Here is what the project is all about.
The program should be able to sample data stream in real time from a running machnery and then compare data held in a database corresponding to different fault condition to the data stream in real time and them output the result in the form of the status of the machine.(i.e, whether the fault data corresponds to any portion of the continuous stream.
I will also appreciate codes on Neural Network (Backpropagation Algorithm or any ANN codes). I will strongly appreciate any response to enable me get started.
I can be reached at v_itulua@hotmail.com
v_itulua@hotmail.com
|
|
|
|
|
Is it ever possible to print a form into a picture box. Any ideas..
|
|
|
|
|
Use windows api to capture form as BMP and display inside picture box control...?
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
When trying to call a dynamically declared .dll function, i pass in a String, but when i debug it inside of VC, it's junk ("????????????????") anyone see that happen before? and know how to fix that in an already made ATL Object in VC?
~Timothy T. Rymer
www.digipen.edu
tim.xpertz.com
|
|
|
|
|
Can you give a small example of code (C++/ATL and VB) that gives this behavior? I remember having this sort of problem, but I don't remember how I solved it
(Though I did solve it, so maybe I'll be able to help )
Volodya Orlenko,
orlenko [at] hotmail [dot] com
|
|
|
|
|
Ok, well first I created an ATL COM AppWizard .dll,
and then created an ATL Object.
Then in CMyObject(not IMyObject) I created a function that had a BSTR for a parameter (just input) and i tried setting the return value to "void _stdcall" and "void __declspec(dllexport)"
and then going into the .def file, i added the appropriate function names and added the "@number" after each, but when i run it in my VB program, and debug the dll from VC++, it will either have "" <-- nothing in the string (and i've debugged from vb and there is stuff passed in) or mumbojumbo that either looks like:
"?????????????????????????"
or
"?[the return character] <-- this repeated a bunch"
and then it'll crash when i close it or whatever.
I'm trying it in a regular dll now, but i would rather just make the small changes to the object's functions. Any help would be grand! I'm glad someone else has at least had this happen before, so any help/advise is awesome thanks
~Timothy T. Rymer
www.digipen.edu
tim.xpertz.com
|
|
|
|
|
If I understand you correctly, you created an ATL Dll, a COM object in it, and now you want to use its methods just as dll functions, without that COM object at all? That will not work.
To create a simple dll to be used from VB or C or whatever, you do not need ATL. Use "New", then select "Win32 Dynamic-Link Library" in your Visual C++.
Volodya Orlenko,
orlenko [at] hotmail [dot] com
|
|
|
|
|
The thing is, is that I can get into the Function though, and debug through it, I tried using a function outside of the ATL object as well, but it still wouldnt work.
Check this article out, do you see anything that he might be forgetting to tell me?
http://www.codeproject.com/dll/superdll.asp#xx77114xx
~Timothy T. Rymer
www.digipen.edu
tim.xpertz.com
|
|
|
|
|
Ok, I see what you ae trying to do. Please download that example and modify it for your needs. It works.
Note that he did not use any COM classes! You could do exactly the same by creating a new dll from scratch.
Volodya Orlenko,
orlenko [at] hotmail [dot] com
|
|
|
|
|
Yeah, that is a totally an awesome thing, but i got my ATL Class to work!
In MSDN, if you're messing with strings, it says to use LPSTR when you're recieving a string, and it worked! and that is a public function inside a ATL Class, so it's something else to remember...
~Timothy T. Rymer
www.digipen.edu
tim.xpertz.com
|
|
|
|
|
ATL objects are COM objects. You've got to create an instance of a class to use its functions.
In general, you cannot use a member function of your C++ class without creating an instance of that class.
It looks like you try to use member functions without creating any variables of that object's type.
Volodya Orlenko,
orlenko [at] hotmail [dot] com
|
|
|
|
|
Are there any good techniques for restricting access to an ActiveX DLL (not control) created with VB?
Thanks!
- Alex
|
|
|
|
|
I've never created a control in VB only VC. Runtime licenses are used in VC, isn't this available in VB...?
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|