|
|
I've imported an ActiveX component in VC++ program as
#import "INPClnt.ocx"
compiler has generated INPClnt.tlh file as below
----------------------------------------------------------
// Created by Microsoft (R) C/C++ Compiler Version 12.00.8168.0 (73b0260c).
//
// c:\samples\sampleb\debug\INPClnt.tlh
//
// C++ source equivalent of Win32 type library INPClnt.ocx
// compiler-generated file created 11/28/03 at 18:17:12 - DO NOT EDIT!
#pragma once
#pragma pack(push, 8)
#include <comdef.h>
namespace INPCLNTLib {
//
// Forward references and typedefs
//
struct __declspec(uuid("b2878606-c652-11d4-8481-00c04f369af0"))
/* dispinterface */ _DINPClnt;
struct __declspec(uuid("b2878607-c652-11d4-8481-00c04f369af0"))
/* dispinterface */ _DINPClntEvents;
struct /* coclass */ INPClnt;
//
// Smart pointer typedef declarations
//
_COM_SMARTPTR_TYPEDEF(_DINPClnt, __uuidof(IDispatch));
_COM_SMARTPTR_TYPEDEF(_DINPClntEvents, __uuidof(IDispatch));
//
// Type library items
//
struct __declspec(uuid("b2878606-c652-11d4-8481-00c04f369af0"))
_DINPClnt : IDispatch
{
//
// Wrapper methods for error-handling
//
// Methods:
VARIANT_BOOL Startup ( );
VARIANT_BOOL Shutdown ( );
VARIANT_BOOL ProcessBatch (
_bstr_t BatchFilename );
VARIANT_BOOL ProcessImage (
_bstr_t ImageFilename );
_bstr_t GetProperty (
_bstr_t Keyword );
VARIANT_BOOL SetProperty (
_bstr_t Keyword,
_bstr_t Value );
};
struct __declspec(uuid("b2878607-c652-11d4-8481-00c04f369af0"))
_DINPClntEvents : IDispatch
{};
struct __declspec(uuid("b2878608-c652-11d4-8481-00c04f369af0"))
INPClnt;
// [ default ] dispinterface _DINPClnt
// [ default, source ] dispinterface _DINPClntEvents
//
// Wrapper method implementations
//
#include "c:\samples\sampleb\debug\INPClnt.tli"
} // namespace INPCLNTLib
#pragma pack(pop)
----------------------------------------------------------------
and also generated INPClnt.tli
----------------------------------------------------------------
// Created by Microsoft (R) C/C++ Compiler Version 12.00.8168.0 (73b0260c).
//
// c:\samples\sampleb\debug\INPClnt.tli
//
// Wrapper implementations for Win32 type library INPClnt.ocx
// compiler-generated file created 11/28/03 at 18:17:12 - DO NOT EDIT!
#pragma once
//
// dispinterface _DINPClnt wrapper method implementations
//
inline VARIANT_BOOL _DINPClnt::Startup ( ) {
VARIANT_BOOL _result;
_com_dispatch_method(this, 0x7d1, DISPATCH_METHOD, VT_BOOL, (void*)&_result, NULL);
return _result;
}
inline VARIANT_BOOL _DINPClnt::Shutdown ( ) {
VARIANT_BOOL _result;
_com_dispatch_method(this, 0x7d2, DISPATCH_METHOD, VT_BOOL, (void*)&_result, NULL);
return _result;
}
inline VARIANT_BOOL _DINPClnt::ProcessBatch ( _bstr_t BatchFilename ) {
VARIANT_BOOL _result;
_com_dispatch_method(this, 0x7d3, DISPATCH_METHOD, VT_BOOL, (void*)&_result,
L"\x0008", (BSTR)BatchFilename);
return _result;
}
inline VARIANT_BOOL _DINPClnt::ProcessImage ( _bstr_t ImageFilename ) {
VARIANT_BOOL _result;
_com_dispatch_method(this, 0x7d4, DISPATCH_METHOD, VT_BOOL, (void*)&_result,
L"\x0008", (BSTR)ImageFilename);
return _result;
}
inline _bstr_t _DINPClnt::GetProperty ( _bstr_t Keyword ) {
BSTR _result;
_com_dispatch_method(this, 0x7d5, DISPATCH_METHOD, VT_BSTR, (void*)&_result,
L"\x0008", (BSTR)Keyword);
return _bstr_t(_result, false);
}
inline VARIANT_BOOL _DINPClnt::SetProperty ( _bstr_t Keyword, _bstr_t Value ) {
VARIANT_BOOL _result;
_com_dispatch_method(this, 0x7d6, DISPATCH_METHOD, VT_BOOL, (void*)&_result,
L"\x0008\x0008", (BSTR)Keyword, (BSTR)Value);
return _result;
}
---------------------------------------------------------------
now Question is in my main() program how do I call methods.
Could anyone please help me out?
|
|
|
|
|
My c++ program (compiled in release mode) run correctly in some machine. For some machine it crash and runtime error appear. I don't know what's cause the runtime error and how to solve it.
|
|
|
|
|
A message box appear with the following message ...
//////////////////////////////////////////////////////
Microsoft Visual C++ Runtime Library
Runtime Error!
Program: C:\..\?????.exe <- my program path
This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information.
//////////////////////////////////////////////////////
|
|
|
|
|
Reinstall the software and then try to run. Even after u has the same prblem then just check the any of the controls r added to ur app.
And do the process in the sys where ur trying to run.
I hope this two main problem may cause this type of errors.
Shanmuga Sundar.V
|
|
|
|
|
I wanted to import one active X control(.ocx) and start calling methods.
in Visual C++.
I understand we can do it by using #import "myocx.ocx" . Could anyone
please give me complete example to do it?
|
|
|
|
|
aaahhhh COM run for the hills. Truthfully this is my usually reaction. But FEAR NOT!!! Your dealing with an OCX file. Simply register the file on your system using regsvr32.exe. Then in the fabulous VC6 menu system 'Project', 'Add to Project', 'Components and Controls' then choose the Registered ActiveX Controls folder and select your component. This will automatically generate all the wrapper classes for you (up yours VB boys ) Then you can drag and drop on your new active control and get events, manipulate it whatever. #import is really used for interacting with ATL COM objects that are not ActiveX based.
|
|
|
|
|
Hi , just an question from a novice like me :
how to use #import in c programme ?
not c++ is there an directive like it for c ?
it's for use ADO in a c program
thank you
Adan
that which hesitates is lost.
|
|
|
|
|
Hi All:
I have this function in VC DLL that I would like to call with VB but I am not sure how to declare it.
VC Function:
Syntax:
void _stdcall PlayRequest(
DWORD ClientHandle, //Input parameters
long OutputChannel, //Input parameters
DWORD PlayerHandle, //Input parameters
PlayerInitData SegmentInfo, //Structure; //Input parameters
OSDInitStruct DisplayInfo, //Structure; //Input parameters
PlaySpeedType PlaySpeed, //Input parameters
LONGLONG *pActualStart, //Output
LONGLONG *pActualEnd, //Output
VideoType *pTypeOfVideo, //Output
bool MOL, //Input
void *CMDReserved[20], //An array of pointers reserved for future
use. Should be NULL. // Input
void *RSTReserved[10], //An array of pointers reserved for future
use. Should be NULL.// Output
AOUResult *pResult //Output
);
PlayerInitData
A structure used to initialize the player.
Syntax:
typedef struct{
TCHAR LoggerIPAddress[40];
long TokenNumber;
long ChannelID;
LoggerTime StartTime;
LoggerTime EndTime;
long ChannelType;
}PlayerInitData;
LoggerTime
A structure used for Recorder time
Syntax:
typedef struct
{
long lDate;
long lTime;
}LoggerTime;
OSDInitStruct
A structure used to set the information displayed in the On-screen Display.
Syntax:
typedef struct {
COLORREF m_colorText; //Long
LOGFONT m_fontText; //Structure
TCHAR m_szStaticText[40];
DWORD m_dwOSDBitmap;
} OSDInitStruct;
/* Logical Font */
#define LF_FACESIZE 32
typedef struct tagLOGFONTA
{
LONG lfHeight;
LONG lfWidth;
LONG lfEscapement;
LONG lfOrientation;
LONG lfWeight;
BYTE lfItalic;
BYTE lfUnderline;
BYTE lfStrikeOut;
BYTE lfCharSet;
BYTE lfOutPrecision;
BYTE lfClipPrecision;
BYTE lfQuality;
BYTE lfPitchAndFamily;
CHAR lfFaceName[LF_FACESIZE];
} LOGFONTA, *PLOGFONTA, NEAR *NPLOGFONTA, FAR *LPLOGFONTA;
typedef struct tagLOGFONTW
{
LONG lfHeight;
LONG lfWidth;
LONG lfEscapement;
LONG lfOrientation;
LONG lfWeight;
BYTE lfItalic;
BYTE lfUnderline;
BYTE lfStrikeOut;
BYTE lfCharSet;
BYTE lfOutPrecision;
BYTE lfClipPrecision;
BYTE lfQuality;
BYTE lfPitchAndFamily;
WCHAR lfFaceName[LF_FACESIZE];
} LOGFONTW, *PLOGFONTW, NEAR *NPLOGFONTW, FAR *LPLOGFONTW;
#ifdef UNICODE
typedef LOGFONTW LOGFONT;
typedef PLOGFONTW PLOGFONT;
typedef NPLOGFONTW NPLOGFONT;
typedef LPLOGFONTW LPLOGFONT;
#else
typedef LOGFONTA LOGFONT;
typedef PLOGFONTA PLOGFONT;
typedef NPLOGFONTA NPLOGFONT;
typedef LPLOGFONTA LPLOGFONT;
#endif // UNICODE
Thanks
|
|
|
|
|
I thought I'd answered this on the VB forum already, but obviously not.
The arguments to that API are particularly nasty, so I recommend writing some wrapper functions (or a COM object) in C++ to make the interface more VB friendly.
|
|
|
|
|
Thanks for the reply Mike.
But I managed to get most of the functions worked except this particular one. I keep getting an error "Memory location at 0x???????? could not be written".
This is how I declare in VB:
Public Declare Sub PlayRequest Lib "AOSClient.dll" _
(ByVal clientHdl As Long, ByVal OutputCha As Long, ByVal pHandle As Long, _
PlayerInitData As Any, OSDInitStruct As Any, _
ByVal PlaySpeed As Long, ActualStart As Any, ActualEnd As Any, _
pTypeOfVideo As Long, ByVal MOL As Long, CMDrs() As Any, _
RSTrs() As Any, pResult As Long)
This is how I call the function.
Call PlayRequest(clientHdl, AOSChannel, playerHandle, PlayerInitByte(1), _
OSDStructByte(1), PlaySpeedType, TempBuf(1), TempBuf(9), _
pTypeOfVideo, MOL, CMDReserved(), RSTReserved(), PlayRequestRst)
I believed the error message that I am getting have something to do with passing an UDT to VC Dll.
Appreciate if you could shed some lights. Thanks
|
|
|
|
|
Hello,
Kindly help me as soon as possible.
Problem:
When i run the "Dialog Based" Application in VC++, then the focus is set currently to the BUtton or any other control.
I want, that the focus should always be set on the "Dialog" even if we press "Button" .
e.g. 1) Run the Application.
2) When i click the button, and after clicking it, the focus should be return to the Dialog.
Hoping for a positive response
EsHbAn BaHaDuR
|
|
|
|
|
read carefully the generated code comments...
|
|
|
|
|
zzzZZZzzz....
didnt u get an answer to this a little while ago?
put an invisible button on the dialog that does nothing and set focus to it after every click or whatnot
"there is no spoon" biz stuff about me
|
|
|
|
|
Hi,there
I'm tring to connect a computer through internet with socket,that computer is in a LAN and it can access the internet
but I have no way to identify the computer in that LAN, as the comupter ip exposed in the internet is the LAN's ip.
Is there a good way to solve my problem?
Thanks
Ray
|
|
|
|
|
If the machine has static IP and
If is direct connected to internet just connet to it by IP.
If you can connect to it that means is on the net.
If the computer is behind a firewall/ home-router or proxy
configure the 'gate' to allows incoming connections for that particular
machine . Then you connect to the router/firewall.
If the compuuter does not have a static IP
you have somehow to write a service that reads the machine IP
and ecah time when it change to write you a mail on a yahoo/hotmail
acount sending you the new IP (I have this service I wrote 4-5 years ago)
...or goto freedns.com
and get a name from there and a daemon that runs on your pc and each time
whern you get another IP it notify the freee.dns. Then you can use the
dns name you got from freedns.com.
Hope It Helps.
|
|
|
|
|
I have a spinbottonctrl on my dailog with editbox and Slider that are linked to each other. As I clicked on SpinBottonCtrol and it gets to a certain point all the sudden no more increment. What happend? I explicitly set the range from 0 to 3000. However, when it get somewhere around 500 it stops why why why???
Actually I want it to increment one by one everytime you click even you keep clicking on it for a while( by defalt after clicking a while, it increments by 5 and afterthat 10 as you know).
pNMUpDown -> iDelta = 1;
Was it a problem?
If someone with the answer to this question let me know.
Thanks in advance
Shinya
|
|
|
|
|
Good Q
Same. One has -100 +100 andf othe 0+100 one stops at -7 +7 and the other at 13
|
|
|
|
|
Hello All. i'm trying to get the file properties.
like all the information appear on file properties page ( select file name, right click, properties)
i know i can get the file size, created date, access time, modified time, attributes..
I used following code to get an extral information like titl, author, summary, comments, etc.
<br />
HRESULT hr = S_OK;<br />
IStorage* pStg = NULL;<br />
hr = ::StgOpenStorageEx(wcFilename, STGM_READWRITE | STGM_TRANSACTED, STGFMT_DOCFILE, 0, NULL, NULL, IID_IStorage, (void**)&pStg);<br />
if(FAILED(hr))<br />
{<br />
hr = ::StgOpenStorageEx(wcFilename, STGM_READWRITE | STGM_TRANSACTED, STGFMT_FILE, 0, NULL, NULL, IID_IStorage, (void**)&pStg);<br />
if(FAILED (hr))<br />
return false;<br />
}<br />
<br />
IPropertySetStorage* pPropSet = NULL;<br />
hr = pStg->QueryInterface(IID_IPropertySetStorage, (void**)&pPropSet);
but it only work for MS office files. it doesn't give any information for other regular file like, pdf, tiff, jpeg files.
How can i get the information properties of regular file (eg. pdf, tiff, html, jpg,giff,etc..)
Thank you
|
|
|
|
|
I'm adding to this editor (http://marius.homeunix.org:8000)
Sphere template brush.
The sphere of course has more polygons than any other primitive there.
So If I create a sphere with 32 bands and 32 sections I get 1K polygons. Sphere is a solid so all its facea are facing out, so the BSP will be a straight line having on left 1024 nodes and each of it
on right s empty node containing one polygon.
o
/
/\1
/\1
/\1
...
/
x
By building a BSP out of this (preparation for CSG)
I get Stack Overflow. I tried to reduce the stack storage
to minimum So I reduced it from 1040 bytes to 600 bytes.
The number of recurvie calls has increased a bit but I still get
the stack overflow.
Have you any ideea of unroling the BSP compilatin ptrocess.
Thx
void MiniBsp::R_Compile(int nodeIdx, dynaArray<poly>& polys)
{
dynaArray<poly> frontPolys;
dynaArray<poly> backPolys;
CMiniNode* pNode = _nodesPtr[nodeIdx];
pNode->_planeIdx = GetBestSplitter(polys, 0);
int splitters = polys.size();
while(polys.size())
{
Poly& curPoly = polys.back();
if(curPoly.IsSplitter())
splitters--;
REL_POS whereIs = curPoly.Classify(pNode->GetPlane());
switch(whereIs)
{
case ON_PLANE:
if(ISZERO(VDp(curPoly._normal, pNode->GetPlane()._normal)-1.f))
frontPolys.push_back(curPoly);
else
backPolys.push_back(curPoly);
break;
case ON_FRONT:
frontPolys.push_back(curPoly);
break;
case ON_BACK:
backPolys.push_back(curPoly);
break;
case ON_SPLIT:
{
Poly frontPoly;
Poly backPoly;
curPoly.Split(pNode->GetPlane(), frontPoly, backPoly);
backPolys.push_back(backPoly);
frontPolys.push_back(frontPoly);
}
break;
default:
break;
}
polys.pop_back();
}
if(frontPolys.size())
{
if(splitters == ) // MAKE A LEAF
{
CMiniNode* fn = CreateNode(NODE_LEAF);
pNode->_nodeidx[N_FRONT] = _nodesPtr.size();
fn->_polyIdx = _polys.size();
fn->_nPolys = frontPolys.size();
AddNode(fn);
colex::append(_polys, frontPolys);
UpdateNodeBB(fn, frontPolys);
frontPolys.clear();
}
else // continue
{
CMiniNode* fn = CreateNode(0);
pNode->_nodeidx[N_FRONT]=_nodesPtr.size();
fn->_idxParent = pNode->_idxNodeThis;
AddNode(fn);
R_Compile(pNode->_nodeidx[N_FRONT], frontPolys);
}
}
if(backPolys.size()) // MAKE A SOLID LEAF
{
CMiniNode* bn = CreateNode(0);
pNode->_nodeidx[N_BACK] = _nodesPtr.size();
bn->_idxParent = pNode->_idxNodeThis;
AddNode(bn);
R_Compile(pNode->_nodeidx[N_BACK], backPolys);
}
else // continue
{
CMiniNode* bn = CreateNode(NODE_LEAF|NODE_SOLID);
pNode->_nodeidx[N_BACK]=_nodesPtr.size();
bn->_idxParent = pNode->_idxNodeThis;
AddNode(bn);
}
}
|
|
|
|
|
Just an idea that I've used experiencing the same kind of problem in my product(http://members.cox.net/igor.tebelev/astlview2.htm ).
I don't know possible depth of your recursion, but for my case, where I was traversing just 3 edges of triangular plane in order to find not connected triangles and extract different solids from multiple assembly: i had to implement alot in optimization in stack size reduction:
1. minimize stack variable usage (600bytes is alot -- I don't know specifics of your code, but why not allocate stack dynaArrays in your case on the heap?);
2. minimize call arguments size (maybe it's impossible in your case, but you may consider instead of having 2 args passed to recursive function, have just 1 pointer to the struct containing those 2 values);
3. try to replace your local stack vars with possible static equivalents if not used from different thread ( for example in your case, why can't CMiniNode* fn can't be static? or Poly frontPoly; Poly backPoly?);
4. declaring your recursive function static (if possible), so this will not occupy place on the stack...
5. it all depends on the logic, but you may look into some kind of optimization that will protect from possible reentrance and attempt to analyze something that could of been done before (not sure you have this case)...
After doing all of the above in my case: I was still getting stack overflow cases. So, what eventually I've done: reinvested some time in changing algorithm, so I limited my recursion by some constant depth of the recursion, and as soon as it was getting reached I was interrupting it and restarting again from the top, however I was saving important data in one huge array, so my next recursive call doesn't process entities already processed and was using that arrays data however. Not sure it's possible in your case, but only you can come up with something like that.
I've managed to resolve that problem back then. However, there maybe another approach that I've tried more advanced approach back then and it worked just fine: It requires some adavanced ASM skills, but basically it was like that as soon as constant depth of the recursion was reached: you allocate some memory on the heap, change stack pointer and etc...
Regards
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
Thank you Igor.
I'll dig into it this weekend.
Thank you again.
P.S. Cool 'StlView' you have.;)
|
|
|
|
|
BTW: I forgot to mention another alternative.
Imagine the following solution, that I've also tried at some point:
Instead of playing with ASM in stack switching: you may reuse treads to perform your deep stack calculations. So, what you do again have some stack call counter and as soon as that variable reaches some threshold, your code spawns separate thread, sets calling args on that thread and runs it again with the call to the recursive function, while thread creator waits till spwaned thread finishes. What happens here is: system creates thread that will either inherit your original stack size or you will specify stack size of that thread. The drawback maybe overhead in thread creation, however that should be tested...
Regards
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
Has anyone done any street address parsing? I'm working on a project that pulls an address of which I need the street address, city, state and zip. Pretty simple working backwards until I hit the city. Then it I hit a snag if the city is 2 words and the user doesn't use a comma.
Any suggestions??
ed
Regulation is the substitution of error for chance.
|
|
|
|
|
I did this exact same thing. I worked backwards from the State/ZIP. You can identify the State because there is a limited set of them for example last word is "York", then scan for "New" in the second to last. The rest is the city. You can grab a list of states from source html for option boxes on the internet.
My neighbours think I am crazy - but they don't know that I have a trampoline. All they see my head bobbing up and down over the fence every five seconds
|
|
|
|
|