Link to home
Start Free TrialLog in
Avatar of isnoend2001
isnoend2001Flag for United States of America

asked on

ocx stops my project when compiled

I recently purchased an screencapture.ocx to enter pictures into my rtf control. It works fine in the ide, but when compiled i can not get my program to run. My project his pretty big. I tried the ocx on a small project and it works as expected. The vendor is telling me to remove componets one by one to find the problem, how can i find this problem?
When i remove the ocx my project runs as expected
Avatar of VR4
VR4

vb6 / .net ?
What if any error message do you get ?
Avatar of isnoend2001

ASKER

I get no error message i briefly see the splash screen then nothing
well ........
Ok, I'll give you my most basic method of troubleshooting.

Put :

MsgBox "Here1"
MsgBox "Here2"
.....
etc.
between every line. In you startup procedure (most likely Form_Load).. see where it kills over.
Then look put up code from start to the message that did not come-up
It will not display messages I have tried this:
Sub Main
msgbox " i made it this far"

Sub Main
DoEvents
msgbox "i made it this far"
It does not display messages, it does nothing
how does your splash screen make it up ?

you shure you start in Sub Main ?

Take a look at Project / "ProjectName" Properties /  General Tab -> StartUp Object

That is your start up location  
hmm, maybe it was not you with the splash screen ?? and then die.
When you say the exe won't run, is it on the same machine ?

ASKER CERTIFIED SOLUTION
Avatar of VR4
VR4

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I have given up without finding a solutation after spending hours trying to fix it. I went back to yesterdays backup and it works as it should. I am re-doing a days work, but it works, most of the redoing is cut and paste.  am going to compile often.
This is a cool little screen capture with 3 lines of code you can get a rectange pasted right into your rtf
http://www.namtuk.com/download.aspx
thanks for the points, and a small word of advice.
Use as littel plug-in stuff as possible or write your own, since one day they all have an issue and its very hard to get anyone to listen.

The screen capture if one looks at the code breakdown is also 3 lines.
1. Declare an API
Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte,        ByVal dwFlags As Long, ByVal dwExtraInfo As Long)

2. Do KeyDown
keybd_event vbKeySnapshot, 0, 0, 0
3. Do Key-UP
keybd_event vbKeySnapshot, 0, &H2, 0

Optional :)) step 4. Get it from keyboard to a picture object in your control:
yourControlPicture = Clipboard.GetData(vbCFBitmap)
That code does not look as thought you can copy only a square of the screen. Can you?
not the above, I think in that case you would copy a portion of the image that you did capture.
i.e. get a portion of the full screen that you got. By using a BitBlt API

Here is a better version of the above:

Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Integer, ByVal x As Integer, _
    ByVal y As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, _
    ByVal hSrcDC As Integer, ByVal xSrc As Integer, ByVal ySrc As Integer, ByVal dwRop As Long) As Integer
Declare Function GetDesktopWindow Lib "user32" () As Long
Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Public Const SRCCOPY = &HCC0020
Public Const SRCAND = &H8800C6
Public Const SRCINVERT = &H660046

Private Sub Command1_Click()
    Dim DeskhWnd As Long, DeskDC As Long
    DeskhWnd& = GetDesktopWindow()
    DeskDC& = GetDC(DeskhWnd&)
    'You can do the same with form instead of Picture box
    'Here you can change your rectangle size.
    BitBlt Picture1.hdc, 0&, 0&, Screen.Width, Screen.Height, DeskDC&, 0&, 0&, SRCCOPY
End Sub