|
Hi all
I had written a FTP directory listing program.Problem here is its working fine on my FTP server,but its not working working on client ftpserver i.e.,iam unable to get directory listing there....
I used following classes:
class CFileFind;
class CInternetSession;
class CFtpFileFind;
pf = is.GetFtpConnection((LPCTSTR)servername, (LPCTSTR)username, (LPCTSTR) pwd, portno, session_mode);
although i have set session_mode both TRUE and FALSE, it still doesn't work or throw any exception
Thanks,
xyz
|
|
|
|
|
Hi,
I am a newbie in MFC gui programming. Here is one problem that I am facing..
I am setting text in an edit control and then i need to set the cursor at the end of the text. If I use SetEditSel, it highlights the text also. I do not want the highlighting of the text. I just want the cursor to be at the end of the text ,after I have called SetWindowText().
I searched around and found that SetCursorPos can help. But I do not know how to provide the correct text coordinates to this API. any ideas would be greatly appreciated.
Code snippet:
InSomeHandler(){
GetWindowText(str);
// do something
SetWindowText(str);
// set the cursor at the end: don't know how to do it..
}
Be the change you wish to see...
|
|
|
|
|
You can use SetSel for this. I assume you're using a CEdit control. Let's say this control is accessed through a member variable called m_edit and contains the text str , you can then set the cursor to the end of the control by calling this:
m_edit.SetSel(str.GetLength(), 0, FALSE);
|
|
|
|
|
...and probably other VC editions.
I've not the need/use of Intellisense and it bothers me a lot slowing down my projects load/unload time so I searched and found a way to get rid of it.
Simply delete C:\Program Files\Microsoft Visual Studio 8\VC\vcpackages\feacp.dll.
Yarp
http://www.senosoft.com/
|
|
|
|
|
Hello gang,
I have an engine in legacy c as a dll and wanna get its functionality from a UI written in c#. what makes me sick is that as project grows and complexities increased how is it possible to debug c# and its legacy 'c' dll toghether. I again say simply i want to F11 my c# line and go to legacy c functions and vice versa ...
give me a clue please if you know the tips...
http://www.packetforum.org
|
|
|
|
|
I wrote a DLL and want to put it into a XP workstation in my Lan, certainly, i know its administrator account password. but how can i put it into its system folder without setting any share folder manually? if it is possible, then how can i invoke the rundll32 command to load my dll remotely? Thanks for your instruction.
liur
|
|
|
|
|
You can't "run" a DLL. You can load it with an executable, but you can't run it by itself.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Thanks, my mean is how to put the dll into remote XP and loading it by rundll32 command. could you give me any suggestion?
liur
|
|
|
|
|
First you have to get the DLL over to that machine. So it's a simple case of how do you want to get the file over there. You have options: E-mail, on a floppy, windows file sharing, etc.
|
|
|
|
|
I am trying to pass a reference through a couple of layers of functions, and I am getting a C2664 Error.
Here is my setup:
I have a class [ c_ClassOne ] which contains a pointer to an object [ p_MyObject ].
I have a second class [ c_ClassTwo ] which has a function [ FunctionOne(MYOBJECTTYPE* myObject) ]
I have a third class [ c_ClassThree ] which also has a function [ FunctionTwo(MYOBJECTTYPE* myObject) ]
I then try to pass the reference to the pointer p_MyObject from c_ClassOne to be used within FunctionTwo.
So in a function within c_ClassOne I create an instance of c_ClassTwo [ myClassTwo ]
I then pass a reference to p_MyObject as follows: myClassTwo.FunctionOne(&p_MyObject);
Then within FunctionOne, I create an Instance of c_ClassThree [ myClassThree ]
I then attempt to once again pass the reference to p_MyObject: myClassThree.FunctionTwo(&p_MyObject);
On that line I get the following error:
error C2664: 'CD3DInitialize::Enumerate' : cannot convert parameter 1 from 'LPDIRECT3D9 ** ' to 'LPDIRECT3D9'
Note: LPDIRECT3D9 is the Object Type of p_MyObject.
Can anyone explain what I am doing wrong, and help me understand how to do it correctly?
Thanks,
Jody
|
|
|
|
|
Just pass it like this:
myClassTwo.FunctionOne(p_MyObject);
myClassThree.FunctionOne(p_MyObject);
Your functions are accepting pointers, and the object you're passing is a pointer. There is no need to dereference it.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hello, I have Oracle 9i and Oracle Developer6i.I want to build an Oracle DB base using Oracle tools how to do it?. Then I want to developt a db application using VC++6 to access oracle db .
Thank u
|
|
|
|
|
to access oracle db using vc++, you can use ADO:
#define INITGUID
#import "c:\program files\common files\system\ado\msado15.dll" rename_namespace("ADO_RWXLS") rename("EOF","EndOfFile")
using namespace ADO_RWXLS;
#include "icrsint.h"
_ConnectionPtr pConn;
::CoInitialize(NULL);
pConn.CreateInstance(__uuidof(Connection));
CString strConn;
strConn.Format(_T("Provider=MSDAORA.1;Data Source=%s;Database=%s;User ID=yourname;Password=yourpasswd"),strServerName,strServerName);
pConn->Open(str_Connection, "", "", adOpenUnspecified);
liur
-- modified at 2:22 Sunday 14th January, 2007
|
|
|
|
|
Hi all,
well allthough I'm new to C++ I've done my share of development in more user friendly environments, mainly C#.
Anyhow I want to learn C++ as mainly personal interest as my professional life will be focused primarly in .NET development whenever it is needed.
To learn the basics of the language I'm starting with a real easy Math class that will initially implement a Matrix (no templates). Nothing fancy but an easy place to start to at least start learning Object Oriented programming in C++ like any other.
Well the thing is that I'm completely stumped with an error I'm getting. I've created a simple Win32 console app that links my FastMath.dll and uses the FMatrix class defined inside. Test app code is as simple as it can get, it only instantiates one FMatrix and then deletes it, and something that simple is giving me a runtime error. Here's the code in the tesp app:
#include "stdafx.h"
#include "FMatrix.h"
using namespace FastMath;
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
FMatrix *a=new FMatrix(5);
cout << "A is a [" << a->GetRowCount() << "x" << a->GetColumnCount() << "] matrix." << endl;
delete a;
return 0;
}
Ok the error I'm getting is when executing "delete a". The error message is:
Windows has triggered a breakpoint in Tester.exe.
This may be due to a corruption of the heap, and indicates a bug in Tester.exe or any of the DLLs it has loaded.
The output window may have more diagnostic information
If I try to continue I get the same error once and then succesive Assertion Failed error messages: "Expression: _CrtIsValidHeapPointer(pUserData)" and if I ignore that I get a HEAP CORRUPTION DETECTED error message "CRT detected that the application wrote to memory after end of heap buffer."
I really do not understand what I'm doing wrong in my FMatrix file. I'm including header and source files below:
FMatrix.h
#ifdef FASTMATH_EXPORTS
#define FASTMATH_API __declspec(dllexport)
#else
#define FASTMATH_API __declspec(dllimport)
#endif
#pragma once
#include "StdAfx.h"
namespace FastMath
{
class FASTMATH_API FMatrix
{
private:
int rw,cl;
double *val;
FMatrix(void);
FMatrix(unsigned int,bool);
FMatrix(unsigned int,unsigned int,bool);
void initMatrix(unsigned int,unsigned int,bool);
void destroy(void);
public:
FMatrix(const FMatrix&);
FMatrix(unsigned int);
FMatrix(unsigned int,unsigned int);
FMatrix(unsigned int,unsigned int,double**);
~FMatrix(void);
static FMatrix* CreateIdentity(unsigned int);
static FMatrix* CreateFull(unsigned int,unsigned int,double);
static FMatrix* CreateRandomIntMatrix(unsigned int,unsigned int,int,int);
static FMatrix* CreateRandomDblMatrix(unsigned int,unsigned int,double,double);
double GetItem(unsigned int,unsigned int) const;
void SetItem(unsigned int,unsigned int,double);
int GetRowCount() const;
int GetColumnCount() const;
static bool AreSameSize(const FMatrix&,const FMatrix&);
FMatrix& operator =(const FMatrix&);
FMatrix& operator -() const;
FMatrix& operator +(const FMatrix&) const;
FMatrix& operator -(const FMatrix&) const;
FMatrix& operator *(double) const;
FMatrix& operator *(const FMatrix&) const;
FMatrix& operator !() const;
bool operator ==(const FMatrix&) const;
bool operator !=(const FMatrix&) const;
};
}
FMatrix.cpp (only relevant code)
#include "StdAfx.h"
#include "FMatrix.h"
#include "time.h"
#include <cstdlib>
#include <iostream>
using namespace FastMath;
using namespace std;
void FMatrix::initMatrix(unsigned int r,unsigned int c, bool initValues)
{
rw=r;
cl=c;
val=new double[rw*cl];
#ifdef _DEBUG
cout <<"++ Matrix created." << endl;
#endif
if (initValues)
{
for (int i=0;i<rw;i++)
{
for (int j=0;j<cl;j++)
*(val+i*cl+j)=0;
}
}
}
FMatrix::FMatrix(unsigned int dim)
{
initMatrix(dim,dim,true);
}
FMatrix::~FMatrix()
{
destroy();
}
void FMatrix::destroy()
{
delete[] val;
val=NULL;
#ifdef _DEBUG
cout << "-- Matrix destroyed." << endl;
#endif
}
1. Only pointer in my class is private member double *val;
2. Only pointer used in constructor is *val that is set with a new double[whatever], thus no non initialized pointers are left hanging once constructor is through instantiating my class.
3. Destructor calls private method destroy() where I delete [] val, set it to NULL and log to the console that the destructor was called.
I'm really confused because I dont know what I'm doing wrong. The thing is if I use in the Test app the static constructors (CreateRandomIntMatrix for example) and I dont have to manually delete them everything works great and the destructor of my two matrixes is called all by itself. But when I explecitly instantiate with the new operator in my test app and thus have to delete them myself in that same app I get the errors described above.
The worst thing is that I'm not getting an error anywhere that i can see when I step through with the debugger. Everything executes perfectly if I put a breakpoint on the exit bracket of my destroy() method. Once I hit the breakpoint and I press continue and the only thing it should do is step out of the Destroy() method and return to the the Test app I get the error. I dont know what's going on at all.
Can this be due to something else and not a coding problem? Some corrupted VS 2005 file or something? I am getting a constant message evey now and then when I build or start debuging my app that tells me "This project is out of date. FastMath - Debug Win32" ??? anyone know what this is and if it can be linked to my problem?
Any help plz?
-- modified at 23:18 Saturday 13th January, 2007
|
|
|
|
|
gumi_r@msn.com wrote: "CRT detected that the application wrote to memory after end of heap buffer."
That means that you allocated a block of memory, but wrote past the end of the block.
|
|
|
|
|
Hi Micheal,
thanks for the input. I guessed that much myselft but the problem is that I'll be damned if I see where I wrote past the allocated memory. Only the constructor and destructor are running in my test app and I don't see anywhere in the running code where I could be writing past any alocated memory.
I really dont understand what is wrong.
|
|
|
|
|
Hi,
Have you tried to override the delete operator?;)
Regards,
Eli
|
|
|
|
|
1. I am creating an instance of class-W from within class-A function-B.
Can the instance of class-W be referenced outside of class-A function-B? I suspect it cannot and don't want to push a rope.
2. I can create an instance of class-W in the header of class-A and reference it all through class-A. For example, the following creates an instance of class Ladder which is available to all functions in class-A:
Ladder LC;
Then I can then do the following all through class-A
LC.SomeLadderFunction()
Suppose I create a pointer to Ladder like this:
Ladder *XY
How can I assign LC to pointer XY so I can say
XY->SomeLadderFunction();
Thanks
|
|
|
|
|
|
I have placed two buttons in a cstatic. I have added this static as a child control in a status bar. The buttons highlight state is not udpdated even if the mouse pointer is taken out of the button after lbuttondown. How does the same work fine if the buttons are placed in a dialog?
Thanks
|
|
|
|
|
These are push button types? What highlight state are you referring to?
Mark
|
|
|
|
|
hi
i want to know if we can open and close the USB port and if we can how ?? and how we can get the data from any device such a mouse connected with the USB ???
ahmad al-omar
|
|
|
|
|
You can open the port using CreateFile() function -eg. CreateFile("usb0001") -. Then get the file handle returned by the function and deal with it as you would read/write data from/to a file.
Regards
|
|
|
|
|
To my fellow programmers, I come forth again with another issue.
For review, I am reading from an MS Access database into a console app. In the database, I have data all being read by the console app as strings. However, there are two pieces of data I wish to convert from string to integer. Here is the code:
<br />
CoInitialize(NULL);<br />
try<br />
{<br />
_RecordsetPtr pGetInfo("ADODB.Recordset");<br />
_bstr_t strMyDB("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=FinalDB.mdb");<br />
pGetInfo->Open("SELECT * FROM [Video];", strMyDB, adOpenKeyset, adLockOptimistic, adCmdText);<br />
pGetInfo->MoveFirst();<br />
while (!pGetInfo->EndOfFile)<br />
{<br />
sID = (char*) ( (_bstr_t) pGetInfo->GetFields()->GetItem("Vid_ID")->GetValue() );<br />
sTitle = (char*) ( (_bstr_t) pGetInfo->GetFields()->GetItem("Vid_Title")->GetValue() );<br />
sFormat = (char*) ( (_bstr_t) pGetInfo->GetFields()->GetItem("Vid_Format")->GetValue() );<br />
pGetInfo->MoveNext();<br />
iIndex++;<br />
}<br />
pGetInfo->Close();<br />
}
Now, thanks for the answer to VuNic and CoffeeAddict(##), I am supposed to itoa() the (char*) as so:
<br />
iVidTotal = itoa(sAmount);
iAvailable= itoa(sAvailable);
However, eh... ... when I compile under MS's IDE 2003, I get that the itoa() doesn't take only 1 argument. When I checked the MSDB, it requires three arguments, each I have no certain idea what they do. Just remember, I have the header <stdlib.h> in my header file, just to let you guys know. So, yeah.... I thank you guys in advanced.
Like a friend said, "TOO GOOD!" ありがとうございます!
|
|
|
|
|
I think you're going the wrong way - maybe you want atoi()
|
|
|
|
|