Posts: 1,190
	Threads: 276
	Joined: Jul 2022
	
	
 
	
	
		I want to, in the exe file, only register the OCX component when loading fails.
The Mac01 code always works, but it registers the OCX every time it runs.
The Mac02 code, which I modified according to the QM help file, does not work
Macro 
Mac01 
RegisterComComponent "$qm$\GdPicture.NET.14.tlb" 2|4
typelib GdPicture_NET_14 "$qm$\GdPicture.NET.14.tlb"
Macro 
Mac02 
typelib GdPicture_NET_14 "$qm$\GdPicture.NET.14.tlb"
#err 1
if(RegisterComComponent("$qm$\GdPicture.NET.14.tlb" 2|4)!=1) out "Registration failed"; ret
 
 
	
	
	
		
	Posts: 12,239
	Threads: 144
	Joined: Dec 2002
	
	
 
	
	
		Maybe a better way exists, I don't remember. I would try code like this:
Macro 
Macro3406 
typelib GdPicture_NET_14 "$qm$\GdPicture.NET.14.tlb"
SomeTypeFromTheTypelib x._create
err
,RegisterComComponent "$qm$\GdPicture.NET.14.tlb" 2|4
,x._create
 
 
	
	
	
		
	Posts: 1,190
	Threads: 276
	Joined: Jul 2022
	
	
 
	
		
		
		03-17-2024, 02:03 PM 
(This post was last modified: 03-17-2024, 02:04 PM by Davider.)
		
	 
	
		When executed in QM, the following warning appears:
Warning in <open ":1030: /571">TX Text32_T2: This COM component was not registered: D:\RPA\QM\GdPicture.NET.14.tlb
    QM now registered it automatically. Automatic registration will not always work. Use it only when testing new components. 
---------------------------------------------------------------------------------------------------------------------------------------
After generating the .exe file, the library cannot be loaded. The error occurs in the sub-function sub.DlgProc
Error info:
 ActiveX control is not created. 
function# hDlg message wParam lParam
sel message
    case WM_INITDIALOG
    
    tx3._getcontrol(id(3 hDlg))
	
	
	
	
	
 
 
	
	
	
		
	Posts: 12,239
	Threads: 144
	Joined: Dec 2002
	
	
 
	
	
		I don't remember all QM COM stuff, and cannot help. All info is in the help file.
	
	
	
	
	
 
 
	
	
	
		
	Posts: 1,190
	Threads: 276
	Joined: Jul 2022
	
	
 
	
		
		
		03-17-2024, 10:20 PM 
(This post was last modified: 03-17-2024, 10:21 PM by Davider.)
		
	 
	
		Anyway, thanks for your help!
Place the following code at the beginning of the code.
When executed in QM: no warnings or error messages, it runs fine.
When executed in EXE, "NO" will be displayed in the output bar of QM, which seems to bring success closer.
#opt err 1
if(RegisterComComponent("$qm$\GdPicture.NET.14.tlb" 2|4)!=1) out "NO"; ret 
#opt err 0