|
need help please. been stuck with this problem for a long time
|
|
|
|
|
To begin with, I don't the exact answer but here are some things to look into a maybe get a hint.
First, run dumpbin /exports on your DLL. If you don't see beep listed as an export then you don't quite have it.
What I expect you to see is _beep. If you were to pass it arguments you would probably see "@4 or @8" following it. The reason being that I believe VB uses the _stdcall sequence nearly always.
Given the answers to these questions, you should be able to make the correct prototype header file for your library. As a first guess, I would use this prototype :
#define import __declspec(dllimport)
import void __stdcall beep(void);
Let us know what you find and how this works.
|
|
|
|
|
ok, i did the dump but i have never used that b4 so i have posted s acreenshot for you to look at the summary.
http://www.gobbets.com/dump.jpg
|
|
|
|
|
The beep function was not exported.
CLaW mentioned that VB does not create normal DLLs and your dumpbin screen tends to confirm this. It appears to me that you are SOL.
Sorry.
|
|
|
|
|
VB does not export normal DLLs, it creates COM DLLs.
These can not be used directly in C++ like a normal DLL, but you can invoke them just like any other COM object in C++.
Just keep your eye out for consuming COM objects in C++, especially COM DLLs
// Rock
|
|
|
|
|
How can I get SendMessage to work with a window that isnt in my program?
How would I tell it which winow handle to send to?
To get more of an idea what im doing...
class CWnd * Handle=FindWindow("AIM_CSignOnWnd",NULL);
SendMessage(WM_SETTEXT,0,(LPARAM)(LPCTSTR)SnArray[y])
Right now, all it does it make the Header of the current window equal to SnArray[y]... Im trying to get the window in AIM_CSignOnWnd to have that text sent into one of its message boxes. AIM_CSignOnWnd is a window completly outside of my program (part of AOL Instant Messenger)
There is a good possibility that i'm doing this in the completely wrong way, so point that out if you think so.
|
|
|
|
|
You can send messages to other processes with ::SendMessage(HWND Hand...)
but you can not send pointers to memory through messages (which is what you appear to be doing). this is because each process has its own memory chunk. your valid pointer in one process will point to junk in another process.
*edited to add:
The solution is to inject a thread into your target process, put a string in its memory, then return the pointer to your own application, where you can do further processing, and send the message with a valid pointer back into the target process.
// Rock
|
|
|
|
|
It sounds like you have made some of the required progress already. As your call to
CWnd * Handle=FindWindow("AIM_CSignOnWnd",NULL);
Is returning a valid pointer to the main window, from here, you can use this CWnd* pointer to get controls/windows on the main window. If you start up spy, you should be able to snoop the AOL window to find out the ID number of the window you want to set the text of, Once you have done that, you should be able to get a CWnd* pointer to it:
CWnd *pWindow = handle->GetDlgItem(id_of_control) ;
if (pWindow != NULL)
{
pWindow->SetWindowText("Some text") ;
}
I am not sure about how valid it is passing the string across, as you may need to mess around with memory in the system address space (which should be accessable from both applications).
Give it a try and see if it works.
Roger Allen
Sonork 100.10016
If I'm not breathing, I'm either dead or holding my breath.
|
|
|
|
|
Has anybody had a problem with the VC.Net make always rebuilding resource files when you build the project? This was an imported project from VC6.
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
Have you checked the date on the file ?
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Just verified that the .rc is from 11/20/01 while the .res is from today. Checking the includes...
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
Could anyone give me an example of some code that would dump the contents of a file, line by line, into an array?
|
|
|
|
|
ifstream str(_T("Myfile.txt"));
if (!str.is_open())
{
AfxMessageBox(_T("Could not open file"));
return FALSE;
}
vector<string> file_contents;
copy(istream_iterator<string>(str), istream_iterator<string>(), back_inserter(file_contents));
This assumes you've done the approproate includes (fstream, vector, algorithm, string I believe ) and the appropriate using std:: commands ( ifstream, vector, back_iterator, string and copy ).
I've just tested this ( and found my typo, sorry ), and it works, but it builds a list of words, not sentences. I dunno off the top of my head how to get a stream to not take a space as a delimiter.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
<Center><A href = "http://www.sonork.com" target = "_Blank">Sonork</A> ID 100.10002:MeanManOz</Center><Center>I live in <U><B>Bob's HungOut</B></U> now</center>
|
|
|
|
|
|
With thanks to the wise folks at comp.lang.c++, here is a version that reads a line at a time into the vector:
#include <string>
#include <vector>
#include <algorithm>
#include <fstream>
#include <iostream>
using std::copy;
using std::vector;
using std::string;
using std::ifstream;
using std::ostream_iterator;
using std::cout;
using std::back_inserter;
using std::getline;
int main(int argc, char* argv[])
{
string currentLine;
ifstream str("c:\\winzip.log");
if (!str.is_open())
{
cout << "It's stuffed\n";
return -1;
}
vector<string> file_contents;
while ( getline(str, currentLine) )
{
file_contents.push_back(currentLine);
}
copy(file_contents.begin(), file_contents.end(), ostream_iterator<string>(cout, "\n"));
return 0;
}
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
How can I change the size of an array?
i need to change from a zero-size array to a n-bytes array
ex:
BYTE anything[];
and after some code :
redimensionfunction(anything[], length);
i am using vc++ 6
|
|
|
|
|
You have two options.
1/ USe a pointer. Then you can do this:BYTE * pByte = new BYTE[256];
// use it
delete [] pByte;
pByte = new BYTE[300];
Of course every time you resize, you lose all the contents of the array.
2/ Use vector. Like this:
#include <vector>
vector<BYTE> vecBytes;
for (int i = 0; i < 256; ++i)
vecBytes.push_back(i);
now you have an array of 256 values that can be accessed using [n] notation if you like, or the .at function. But you can also delete from the ends and add new items dynamically at will.
If you want to delete from the middle you want list, but beware, list has the problem of slower access to individual fields ( as it's a linked list it must step through to the element you want )
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
<Center><A href = "http://www.sonork.com" target = "_Blank">Sonork</A> ID 100.10002:MeanManOz</Center><Center>I live in <U><B>Bob's HungOut</B></U> now</center>
|
|
|
|
|
Hi use malloc and realloc
ex.
void *pV = NULL ;
...
...
..
//now u want to allocate 100 bytes
pV = malloc( 100 ) ;
...
..
..
//Now u want to make the same memory 200 bytes.
pV = realloc(pV, 200);
..
..
//Now u want to make it 50 bytes
pV = realloc(pV, 50) ;
|
|
|
|
|
Do NOT use malloc/realloc if you can at all avoid it. They are C functions, and new/delete is highly preferred, especially for complex types. The best reason for this is the fact that new/delete call constructors/destructors and the C functions do not.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
i use globalalloc() and globalfree() and globalrealloc() a lot and they work just fine if you remember to free the memory when u finished with it
whats the problem with this?
---
"every year we invent better idiot proof systems and every year they invent better idiots ... and the linux zealots still aren't being sterilized"
|
|
|
|
|
lauren wrote:
whats the problem with this?
There's no *problem* per se, but if you mix C and C++ memory allocationj calls, you need to be careful not to free something you new'd. You also don't get the benefit of constructors and destructors. If you need to realloc, you should instead use a container like vector. Your code will obviously work, but the way of doing things I am suggesting is *better*.
To read Stroustrup on this ( and I've pretty much quoted him, so you don't need to as such ), turn to page 577 of the third edition of the C++ Programming Language.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Youve all see the new napster Beta i assume, how did they create the toolbar logo. ive tried using a background bitmap but it stays in the same position when the window is resized. i wish mine to glue to the window edge so it will always be on the right hand side frame edge.
.NET or not .NET? MFC is the question......
|
|
|
|
|
I realize I am years behind the times but I am just now moving from VC 5 to VC 6. However, because of third party objects, one application will have to remain in the VC 5.0 environment.
Anyway, do any of you good people know of or have a utility to swap back and forth the debug libraries for each product?
Or maybe even a list of objects that are not compatible?
thanks
|
|
|
|
|
I have heard of such a utility, but never seen it.
If it just the one application you could put a copy of the 5.0 debug dlls in that applications debug directory. If you are running the 5.0 debug version beyond that testing environment put it in a seperate directory and put a copy of the debug 5.0 dlls there.
|
|
|
|
|
Hello all,
How do I detect a CD-RW drive? How do I read/write files onto a CD-RW? Any code or links would also be helpful.
TIA.
#define MOSTLY_LEAN_AND_MEAN
|
|
|
|