|
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
|
|
|
|
|
we dont all live in America!!!!!!!!!!
Id say you should include an Austalian, an English, an American and at least one non english speaking country in your test data.
Perhaps you could define a template for each style of address (post code format etc) and then select the template based on the country (there are a limited set of countries) and they parse the address using the information in the template.
|
|
|
|
|
Do you need a set of valid German adresses for testing?
Just make a sound!
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
Hi I posted a message yesterday as well but i dont still get it what should i do....
it is very simple.. but i have never worked with forms and i only know about consule project. iostream!!
I am trying to build a form and run a specific application with it. I am already made the project as a console project using fstream.
I want to get the name of the file from the user in a specific text Box and then open it as follows:
char fileName[];
ifstream infile;
infile.open(fileName);
However what i get from the textbox is String *f = textBox->Text;
How can i convert this to char[]?
I have already tried char fileName[]=f->ToCharArray(); but it seams there is a problem and i cant convert _wchar to char!!
how can I do this?
is there another way to open the file ?
|
|
|
|
|
Are you trying to get the string from editobx?
If you go with MFC..
CString str_FileName;
CEdit * pEditBox = ( CEdit * )GetDlgItem( ResourceIDForYourTextBox );
pEditBox -> GetWindowText( str_FileName );
I am not sure if this is the answer to your question.
Shin
|
|
|
|
|
no i am just using a simple form. still dont get what u r trying to say!?
|
|
|
|
|
I think hes using Managed C++ not MFC..
|
|
|
|
|
Hi There,
I did a program in VC++ 6.0 for change Password(fields: username / password / new password / confirm new password ).
It is based in MFC (Dialog).
The program is running no problem.
The question is that i need to show a message (like TIP TOOL message) when user will enter with the new password and the CAPSLOCK KEY is actived it should shows a message like: "WARNING: YOUR CAPS LOCK KEY IS ON" it is like a TOOLTIP message, but the diference is that tooltip is based in mouse events and this is based if the CAPS LOCK is turned ON... but the message i want to say is like TOOL TIP message...
Please, can someone help me???
About CAPSLOCK KEY verification it is okay, i am having problems just in the question of SHOW THE MESSAGE!
Thank you all in advance...
My hairs (that are falling for cause of it) will thank you
Fernando
ps: english is not my first language.
Then I must do the simple thing:
|
|
|
|
|