Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
T

Tomaz Rotovnik

@Tomaz Rotovnik
About
Posts
21
Topics
9
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • VB and C++ dll
    T Tomaz Rotovnik

    OK Now I understand. Unfortunately dll is still capturing when the error arrise (I didn't call stop function at all) Tomaz Rotovnik

    Visual Basic question c++ data-structures debugging help

  • VB and C++ dll
    T Tomaz Rotovnik

    Hi When the callback function is trigered 50 times I still capturing the sound. I didn't stop sound capturing. Do I need to call GC.KeepAlive(cb) inside the callback function? Tomaz Rotovnik

    Visual Basic question c++ data-structures debugging help

  • VB and C++ dll
    T Tomaz Rotovnik

    Hi I created very simple dll (vc++) which has three functions (start, stop and initialization). it starts capturing sound from soundblaster and when the buffer is filled with the data, dll calls VB calback function (passed with initialization) and passes the buffer size (integer type). First I have some problems with __stdcall declaration in VC dll, but I think I solved that problem. Callback function runs in separated thread under main dll thread. Declaration of initialization of callback function looks like this: __declspec(dllexport) int __stdcall RecToR_Init_Cap(void (__stdcall *tmp)(int_4 size)); IN VB: Public Delegate Sub Callback(ByVal size As Int32) Public Declare Function RecToR_Init_Cap Lib "RecToR_Cap_TR.dll" (ByVal CalBckFunc As Callback) As Int32 "Private Sub Button1_Click" event in VB: Dim cb As Callback cb = AddressOf CallBackFunc Success = RecToR_Init_Cap(cb) Public Sub CallBackFunc(ByVal size As Int32) TextBox1.Text = size & vbCrLf End Sub When I run the application, the callback function is called 50 times and then the application crashes: "An unhandled exception of type 'System.Runtime.InteropServices.SEHException' occurred in Unknown Module. Additional information: External component has thrown an exception. An exception 'System.NullReferenceException' has occured in..." I think I override stack pointer. How can I trace down the problem? From Microsoft articles I get information that I cannot call callbacks from spawned threads within my DLL. Is it possible to overcome this problem? Thanks for any idea Tomaz Rotovnik

    Visual Basic question c++ data-structures debugging help

  • Callback function
    T Tomaz Rotovnik

    Thank you for your help. I will try with VB.NET framework (as I can see from example), because "Delegate" is not supported in VB 6. I will give feedback as soon as possible. Tomaz Tomaz Rotovnik

    Visual Basic c++ data-structures help question

  • Callback function
    T Tomaz Rotovnik

    Hello I have some problems with integrating dll (written in VC++) into VB application. I looked for some advices through google. I create three functions packed in dll: int_4 __stdcall Konec_RecToR(); //Stop int_4 __stdcall Start_RecToR(); //Start int_4 __stdcall RecToR_Init_Cap(void (*tmp)(unsigned char* array, int size, unsigned char first_frame, unsigned char last_frame, void* ex_param), void* ex_param); First two functions work well in VB application. The problem is the third function which includes two parameters: callback function with five parameters and extra parameter. The syntax in VB is: Private Declare Function Start_RecToR Lib "RecToR.dll" () As Long Private Declare Function Konec_RecToR Lib "RecToR.dll" () As Long Private Declare Function RecToR_Init_Cap Lib "RecToR.dll" (ByVal CalBckFunc As Long, ByRef param As Long) As Long Dim Success As Long Dim param As Long Private Sub Command1_Click() Text1.Text = "ASCII" & vbCrLf & "FG" param = 10 Success = RecToR_Init_Cap(AddressOf CallBackFunc, param) Success = Start_RecToR End Sub Private Sub Command2_Click() Success = Konec_RecToR End Sub //this is in separate module.bas file Public Sub CallBackFunc(ByRef inarray As Byte, ByVal size As Long, ByVal flag_start As Byte, ByVal flag_stop As Byte, ByRef param As Long) Text1.Text = Text1.Text & "TEST" End Sub Application crashes when my dll calls calback function. Did I miss something? Tomaz Rotovnik

    Visual Basic c++ data-structures help question

  • upper limit for an array
    T Tomaz Rotovnik

    I need an huge array and I want prevent application crash. I think I found the answer: max heap size is declared in malloc.h /* Maximum heap request the heap manager will attempt */ #define _HEAP_MAXREQ 0xFFFFFFE0 Tomaz Rotovnik

    C / C++ / MFC question csharp visual-studio data-structures performance

  • upper limit for an array
    T Tomaz Rotovnik

    Hi Perhaps I'm wrong but INT_MAX is defined as maximum int value 2^31-1 What I need is maximum array size for type int Is constant INT_MAX also used to define maximum array size for type int? Tomaz Rotovnik

    C / C++ / MFC question csharp visual-studio data-structures performance

  • upper limit for an array
    T Tomaz Rotovnik

    What is an upper limit for dynamic allocation of single array? For an example: int* A_of_int = new int[X]; What is upper value for X. The environment is visual studio 6 on windows platform (XP). I suppose one of the limits is memory size.

    C / C++ / MFC question csharp visual-studio data-structures performance

  • Send F5 or left arrow message
    T Tomaz Rotovnik

    Thank you Tomaz Rotovnik

    C / C++ / MFC question

  • Remote control
    T Tomaz Rotovnik

    Hello I would like to build c++ application from which I can control office application - power point show. I just want to rotate slides in PowerPoint by simulating left and right arrow. With CreateProcess function I firstly open my application (*.pps). Then I use EnumWindow function to get window handle of my application. Is this window handle correct one? Should I search for child window? I found out that there is no child window for my application (EnumChildWindow). Why? I try to send message like: SendMessage(apphwnd,WM_KEYDOWN,VM_RIGHT,1), but unfortunately nothing happen. I'm sorry if I posted message on wrong board. Tomaz Tomaz Rotovnik

    C / C++ / MFC c++ question

  • Send F5 or left arrow message
    T Tomaz Rotovnik

    Hi What is correct procedure for sending F5 key or left arrow key? SendMesage(hwnd,WM_CHAR,?,?) or SendMesage(hwnd,WM_KEYDOWN,?,?) Tomaz Rotovnik

    C / C++ / MFC question

  • Detecting Keyboard Input in Console Application
    T Tomaz Rotovnik

    Hi, I would like to lead execution of my program with keyboard. I need function which will wait for keyboard input and would not spent any processor time. Is it possible to use GetMessage() and message queues (window based aplications) in console application? Tomaz Rotovnik

    C / C++ / MFC question

  • CEdit in COM
    T Tomaz Rotovnik

    I think I found the problem. I write down steps for those who will have the same problem 1. Because dll which I build is Extension DLL I shouldn't have definition _USRDLL in preprocessor definitions 2. I include CEdit, CString classes which need afxwin.h header so I put #include as first include statement in StdAfx.h header file before all other #include statements. (solved C1189 error) 3. I think CDialog class is MFC so I also set option: Use MFC in a Shared Dll Tomaz Rotovnik

    COM help c++ com lounge

  • CEdit in COM
    T Tomaz Rotovnik

    Hi again I move #include in file StdAfx.h but now I get linking error link: executing 'C:\PROGRA~1\MICROS~4\VC98\Bin\link.exe' nafxcw.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in RecToR.obj nafxcw.lib(dllmodul.obj) : warning LNK4006: _DllMain@12 already defined in RecToR.obj; second definition ignored Creating library ReleaseMinDependency/RecToR.lib and object ReleaseMinDependency/RecToR.exp ReleaseMinDependency/RecToR.dll : fatal error LNK1169: one or more multiply defined symbols found Error executing link.exe. How can I solve that? Tomaz Rotovnik

    COM help c++ com lounge

  • CEdit in COM
    T Tomaz Rotovnik

    Hi I'm creating COM addin for MS Word. I would like to create Option Window for my application, so I used template class CAxDialogImpl(sugested on this message board) class CDial : public CAxDialogImpl I would also like to set(insert) some properties from Edit Box. From MFC I found that Edit Box is attached to CEdit class and value can be read into CString class. Unfortunately when I include CEdit class (or CString) in my declaration of CDial class I get next error: error C2146: syntax error : missing ';' before identifier 'm_edi' error C2501: 'CEdit' : missing storage-class or type specifiers error C2501: 'm_edi' : missing storage-class or type specifiers so I added: #include but then I get VC98\MFC\INCLUDE\afxv_w32.h(14) : fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include I tried also with settings->General: Use MFC in shared dll but no success. Please help Tomaz Rotovnik

    COM help c++ com lounge

  • hWnd in COM Question.
    T Tomaz Rotovnik

    Hi I have one tiny question? Wich header file do I must include for CEdit object? I included but I get an error ***\VC98\MFC\INCLUDE\afxv_w32.h(14) : fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include If I dont include I get error of undefined member 'CEdit' : missing storage-class or type specifiers Tomaz Rotovnik

    COM question c++ com

  • thread in COM for Office Addin
    T Tomaz Rotovnik

    Dear Ryan I tried but I do not know if I understand what should I do. void CMyAddin::StartProcOut() { IStream* M_stream; LPVOID* izh = NULL; CComPtr oSel; CComQIPtr spApp(m_pParentApp); ATLASSERT(spApp); _bstr_t Some_Text(OLESTR("HELLO?")); hr = CoInitialize(NULL); //return S_OK hr = CoMarshalInterThreadInterfaceInStream(IID_IDTExtensibility2,this,&M_stream); //return S_OK while (end_thread_out == false){ if (WaitForSingleObject(h_end_th_out,INFINITE) != WAIT_FAILED){ HRESULT hr = spApp->get_Selection(&oSel); oSel->TypeText(Some_Text); } } hr = CoGetInterfaceAndReleaseStream(M_stream,IID_IDTExtensibility2,izh); CoUninitialize(); } The CLSID_MyAddin is uniq identifier static const GUID IID_IDTExtensibility2 = {0xB65AD801L,0xABAF,0x11D0,{0xBB,0x8B,0x00,0xA0,0xC9,0x0F,0x27,0x44}}; class CMyAddin : public IDTExtensibility2 Is this correct? I still get: Unhandled exception in WINWORD.EXE 0xC0000005: Access Violation CMyAddin is created by class CMyAddinCF : public IClassFactory Tomaz Rotovnik

    COM help database com tutorial question

  • thread in COM for Office Addin
    T Tomaz Rotovnik

    Hello I'm working on COM addin for Microsoft Word application. I build COM addin with two buttons. First button event trigers function TypeText which put some text on screen (in empty document). The problem is when I created thread in COM addin which waits for an event. Thread also includes same function TypeText for printing some text into document. Function is part of "document selection" object declared in MSO.dll. When I trigger an event with second button the function TypeText in my thread is called. I get an error "Exception Handling". Why the same function does not work in thread? please help :(( Here is example of my thread: void CMyAddin::StartProcOut() { CComPtr oSel; CComQIPtr spApp(m_pParentApp); ATLASSERT(spApp); _bstr_t Some_Text(OLESTR("HELLO?")); while (end_thread_out == false){ if (WaitForSingleObject(h_end_th_out,INFINITE) != WAIT_FAILED){ HRESULT hr = spApp->get_Selection(&oSel); oSel->TypeText(Some_Text); } } } Tomaz Rotovnik

    COM help database com tutorial question

  • Use of class function in thread
    T Tomaz Rotovnik

    :laugh:It is working. Thank you. Tomaz

    C / C++ / MFC question c++ tutorial

  • Use of class function in thread
    T Tomaz Rotovnik

    How can I get few parameters into static class function? Should I declare a structure Thread = CreateThread(NULL,0,AudioIn::StartProc,declared-structure,0,&m_ThreadID); or is there a simple way? Thank you Tomaz

    C / C++ / MFC question c++ tutorial
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups