|
Thank you for you response,
I just figured it out a while ago. All I had to do was change the first line of the release options to match the debug options, and it worked.
Thanks a lot,
-----------------
Genaro
|
|
|
|
|
I have program that support only DLL, i want to send msg from it to MSMQ,
so what is the best things that i can do ? can i call function in DLL that have Code to send msg for MSMQ ? if not, then what to do ?
Ali
|
|
|
|
|
Hi
I am trying to understand when sender is useful.In what circumstances i need this?
I have a sample code :
<br />
void __fastcall TForm1::Button1Click(TObect *Sender) <br />
{ <br />
TButton *Button = dynamic_cast<TButton *>(Sender); <br />
if (Button) <br />
{ <br />
} <br />
else <br />
{ <br />
} <br />
} <br />
here it writes :
// do something when a call was made
// passing a NULL value for *Sender)
How can it possible?I mean what type of code passing NULL value for *Sender.I am confused.
Please help me to understand the functionality of sender.
Thanks.
|
|
|
|
|
The sender is a pointer to the object that raised the message ( so, it iwll be the button that was clicked ). I can't imagine why it would be called with NULL.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I use bitmap on my dialog.
Also i use CtlColor function to create transparent static text.
The main problem is that my menu still has the same color.
How to create transparent menu for bitmap Dialog?
|
|
|
|
|
no such menu.
but u can draw or use some controls (i.e. static) to simulate "menu bar", when user clicks them, u popup sub-menu by TrackPopupMenu() function.
-- download last software in my signiture to see its performances.
A special image tool for C++ programmers, don't miss it!
The world unique Software Label Maker is here for you and me ...
A nice hyper tool for optimizing your MS html-help contents.
|
|
|
|
|
I have a little problem:
I use ado to connect to a mysql database (version 4.0.12) and mysql odbc driver(3.51).
The system works fine but recently i ran into this problem:
I've installed it on a LAN consisting of 5 win98SE stations making one of them the database server.
The program works on two of them quite ok but fails on the other 3. The thing is that the other 3 computers still connect to the db but some of the querys fail.
Actually is not the querys that fail but rather the call to _RecordsetPtr->GetCollect("field")
To be more precise a query like "SELECT id, name, address FROM clients" works.
A query like "SELECT clients.id AS id, clients.name AS name, ocupations.kind AS kind FROM clients AS clients, ocupations AS ocupations WHERE clients.ocupationid = ocupations.id" fails when i do a call to pRecordSet->GetCollect(L"kind") with invalid pointer.
Another thing to remember is that the database server is installed on one of the computers that do not work. The stations on which the program works connect to this computer via LAN
So, what do i do? Where should i search for the bug? I really have no ideea.
I never had this problem on winxp and this program works on several win88se networks
|
|
|
|
|
It fails only on the Db server machine? If it is so, one thought is, try to change the recordset CursorLocation.
ConPtr->CursorLocation = ADODB::adUseClient
Or
ConPtr->CursorLocation = ADODB::adUseServer
Try both options. This code is applicable only if you are using ADO. I guess you are using ado as _RecordsetPtr->GetCollect() is an ADO smart pointer.
rgds...mil10
|
|
|
|
|
i don't think that this is the problem. The app fails also on some of the clients. I've mentioned that it fails on the server to show that it is not a LAN problem.
Anyways, my XP station connects to that server and runs just fine but even if i set this station to be the server, the win98se one won't work
|
|
|
|
|
I really do not know what caused this problem but installing the latest MDAC from microsoft solved it It's strange but i remember having a problem that crealy pointed to a data access problem. I fixed it then by installing MDAC 2.8 but it didn't work this time. What fixed it was MDAC 2.8 sp1...
|
|
|
|
|
Hey folks, last time I'm posting about this... thing is, no one reads the posts that appear to have answers, even if they are unsatisfactory
My requirements:
1) No MFC
2) No .NET calls (straight-up c++)
3) Read an ASCII file on disk using calls to ReadFile()
4) Store that data read from the file into the c++ string type.
5) Use C++ STL (because I'm already using string manipulation functions from the STL)
6) Call methods that require the use of LPTCSTRs from the WIN32 API (using my c++ STL strings, converting them somehow if necessary)
7) Write back to the ASCII file mentioned in #3 using LPTSTRs using WriteFile().
8) Rinse & repeat.
My questions for you:
1) I'm a c++ / Win32API / STL newbie, so please provide a clear answer any idiot could understand (me :p), with an example if possible.
2) I'm not sure if _UNICODE is enabled, or how that effects my ability to meet my requirements.
3) I've seen the following code, and it seems to me that if I can just fool C++ into accepting that in the string contanier, it will actually store TCHARs, this sounds good. But I really have no idea how to use it:
typedef std::basic_string< TCHAR > tstring;
#ifdef _UNICODE
#define tstring wstring
#else
#define tstring string
#endif
If you need clairifcations, please feel free to post here, or email me at membos AT yahoo DOT com.
|
|
|
|
|
wstring and string classes have a member function called c_str() which return const pointer to c style string.
for example :
string str1 = "some string";
wstring str2 = "some wide string";
const char* c_str1 = str1.c_str();
const wchar_t* c_str2 = str2.c_str();
now LPCTSTR is define as
#ifdef UNICODE
typedef const wchar_t* LPCTSTR;
#else
typedef const char* LPCTSTR;
#endif
so all you need to do is use c++ string or wstring and when you have to call Win32 API function using c_str() to get a pointer to c_style string.
Hope this helps,
-Saurabh
|
|
|
|
|
Hello,
here my problem with socket:
I've got a simple program with a main that calls a dll dynamically.
Example:
int main(int argc, char *argv[])
{
HINSTANCE lib = LoadLibraryA("C:\\mylib.dll");
if (lib == NULL)
printf("LoadLibraryA failed\n");
}
As my dll has a "DllMain" function, it automatically enters in it and it executes code I want to.
My problem is I want to init socket there and whatever I do the "socket" function failed.
My code compile so I've got the good includes and i've attach the Ws2_32.lib in my dll.
Example:
<code>SOCKET m_socket;
WSADATA wsaData;
int res;
res = WSAStartup(MAKEWORD(2,2), &wsaData);
if (res != NO_ERROR)
{
printf("Error : WSAStartup() [%ld]\n", WSAGetLastError());
return 1;
}
m_socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (m_socket == INVALID_SOCKET)
{
printf("Error : socket() [%ld]\n", WSAGetLastError());
WSACleanup();
return 1;
}
...</code>
Socket function always failed with this error code: 10091 that is in MSDN: WSASYSNOTREADY
In MSDN it is said that this error is returned by WSAStartup. However for me it is the socket function.
If I translate my socket code directly in my main program, it works pretty well. As a consequence, are there some trouble to deal with socket in a dll called dynamically?
Thanks for your help.
-- modified at 14:32 Monday 17th April, 2006
|
|
|
|
|
Well, the first problem is you shouldn't be doing any of that in DllMain() . DllMain() is for simple initialization tasks. Calling into other DLLs from DllMain() will at best fail, and at worst deadlock the process.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
Ok, I've done it works. Effectively, don't do that in your DllMain function but do it via an invoked function.
Thanks for your tips Mike.
|
|
|
|
|
Hello All of you,
Using VC++6(MFC)now i am able to draw the line, circle, ellipse, rectagle. Suppose i want to give them the dimension and modify the corresponding dimension then what should i do.
Is there any source code that can guide How the dimensions given to the geometric entities and modify it.
|
|
|
|
|
Somewhat of a trivial question but I never did grasp the concept. I know that using the new operator we are able to create arrays of a runtime defined size. But this is when you know exactly what size you need the array. eg.
char *foo = "Hello world";
char *bar = new char [strlen(foo) + 1]; But, lets say that code is within a loop, and I want to keep increasing the size of the array without loss of data. How is this done?
In a pratical example, I am working on some code which will open an excel like workbook. Upon reading the file the worksheets are found 1 by 1 and not all at once. Therefore I need to create an array of worksheets and enlarge it each time a new worksheet is found.
|
|
|
|
|
If using MFC, using the CArray<> template. If using STL, using the vector<> template.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
I know vectors are ideal for this, but I would rather not use them if possible in this instance. I was simply wondering how a vector like array would be coded.
|
|
|
|
|
You'll need to create a new array that is one size larger than the current one, copy the contents of the current one to the new one, delete the current one. Make sense?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
It makes sense, though it isn't very efficient. We are basically copying the data 2 times, first to a buffer, then back to the resized array. I was hoping for a better way of resizing an array, but this will suffice.
|
|
|
|
|
waldermort wrote: I was hoping for a better way of resizing an array, but this will suffice.
Basically, that's how the existing containers operate, with one important distinction: when they grow, they do it exponentially - not by one. Thus they reduce the number of copying at the expense of memory space.
Of course, once we have the move semantics in C++ (around 2010, I hope ) this will be a non-issue.
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
Nemanja Trifunovic wrote: Of course, once we have the move semantics in C++ (around 2010, I hope ) this will be a non-issue.
So you don't think we are going to be pushed towards the .NET way of things before then?
|
|
|
|
|
waldermort wrote: So you don't think we are going to be pushed towards the .NET way of things before then?
.NET is a platform, C++ is a programming language. I know quite a few people who make very nice salaries programming with languages like COBOL and Fortran.
But that's a bit OT, anyway.
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
If you are using objects with simple types that need no destruction, you could use alloc() / realloc() . (I've long felt C++ should have a renew keyword, but it never happened.)
(EDIT: you could wrap these in a simple class to ensure proper destruction.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|