|
IMO, just keep one array of Width*Height and have an accessor function with row and column as parameter and just return the item at the appropriate position.
Something like that.
T* = pArray[column * Height + row];
This signature was proudly tested on animals.
|
|
|
|
|
Reading the answers, your problem has been solved.
I just wanted to thank you for possibly the best written question I've seen! Even with a diagram...
Iain.
In the process of moving to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!
|
|
|
|
|
I figure if I don't put any effort in, then my chances of getting a decent answer are pretty low. I try my best to offset some of the terribly-worded questions you see around here. Not to mention the terrible questions!
Thanks to everyone for the help
|
|
|
|
|
Hi,
I need to create an Executable for my MFC AppWizard(dll) project. This is to debug my program. This is a new program and has no idée how to create an Executable. Other existing programs are easy to debug as they have an .exe file link to the .dll. Please, any help would be appreciated.
|
|
|
|
|
Your query is confusing. My best guess is that you're writing a dynamic link library and you do not know how to debug it.
If I'm right, then just try executing the library from within the IDE like you would execute a normal .exe (F5, Ctrl+F5) and the IDE must ask the executable that would be loading this DLL and it would run that executable.
As soon as that executable executes code from within your DLL, the debugger will get activated and you can debug your DLL (break points, you know).
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Thx for the reply. Yes I don’t know how to debug it, the thing is when I hit (F5 or Ctrl+F5) a box pops up asking for the Executable file name. It gives me 3 options: (1) Browse, (2) AxtiveX Control Test Container and (3) Default Web Container. All my other projects that I am working on were pre-existing and they have an Executable. I don’t know how they where created?
|
|
|
|
|
It is asking for an executable because you are working on a library and the library cannot execute on its own. The library will be, in practice, loaded by another executable (or even another library). Just use the browse option and choose the executable that will be loading and using this library. When the library code is executed, the debugger will be activated if you have breakpoints in your library code.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Sorry, but i am confused. Theres no where any .exe to be found. I'm not sure what you ment by :
"Just use the browse option and choose the executable that will be loading and using this library"
Don't i need to create the .exe?
|
|
|
|
|
blokkies wrote: Don't i need to create the .exe?
If you don't have any exe that uses your dll yet, yes you have to create one. You dll can't be used alone, it should be loaded by an executable.
But what is your problem exactly ? Because if you are able to create a dll, creating an executable shouldn't be too difficult...
|
|
|
|
|
my problem is that I am not able to debug my program? When 'n hit F5 it asks me for an executable. When 'n go build, the only option is to build the .dll. Other program that i am working on has an .exe that they use to debug the code. How do I create an .exe for this new project?
Please beer in mind that i am not a C++ programmer but SAS,RPG and SQL.
|
|
|
|
|
blokkies wrote: How do I create an .exe for this new project?
In the same way that you created the DLL, except that you select Application instead of DLL (or Library). What version of VS are you using?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I am using Visual C++ 6.0. I created only one MFC AppWizard(dll) project. On the Build option i can only choose Build XXX.dll (F7).
Thanks.
|
|
|
|
|
blokkies wrote: I am using Visual C++ 6.0.
File --> New --> Projects
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
blokkies wrote: Please beer in mind that i am not a C++ programmer but SAS,RPG and SQL.
Then it's gonna be really complicated to explain what you have to do. Because you'll need not only to create the executable but also add some code inside it to load the dll and call the functions you want to debug.
But if you are not a C++ programmer, why are you developping a DLL ? It seems a bit crazy that you start with that instead of learning the basis (learn the language, create a simple app, ...)
|
|
|
|
|
I agree, but i am just the employee. I have been doing maintenance on existing C++ systems with little problems. Maybe that’s why. But it is something different to start from scratch. I really wanted to get this right.
Thanks for the help.
|
|
|
|
|
Can you just tell me how do i create the Executable?
|
|
|
|
|
You've already been told...at least twice. What more do you require? If you are not going to heed our suggestions, stop asking for help.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
People already told you how to do that (David for instance). But, then ? You will end up an executable that doesn't do anything with the dll and there's no point in that. You will need to add code to load the dll and call some functions but in order for us to help you, you'll need to learn at least the basics of C++ and visual studio.
You think creating an executable is just a matter of clicking there and there and BAM, magically your executable doing what you want is created ?
|
|
|
|
|
To be fair, he might be working with a VB executable
|
|
|
|
|
It depends because it could even complicate things a lot (for instance if he needs to pass strings or objects to a dll function).
|
|
|
|
|
Cedric Moonen wrote: You think creating an executable is just a matter of clicking there and there and BAM, magically your executable doing what you want is created ?
That's what my (non-programming) colleagues tell me!
Iain.
In the process of moving to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!
|
|
|
|
|
Can't you just create a "dummy" Win32 project that links to your DLL?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
blokkies, let me try to summarize what's going on
What is a DLL?
A DLL is a block of useful code that can be loaded by several programs at once
Why would I make one?
Because you want a modular solution. A reusable, easy to update solution.
What is a DLL again??
It is something that one or several actual programs might find useful. It is not a program by itself. You could think of it as a class, if you really wanted to.
What's a program?
... Well a program is a block of code that a human might find useful.
So a DLL is not a program?
Correct :)
So humans use programs, and programs use DLLs?
Right again!
|
|
|
|
|
Is your project used in the program? You say that you're doing mainainance, right? In this case the code you want to debug is already used in your program.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Hello everyone .
i am trying to import a COM file in vc++ project but the generated .tlh file from the com file seems to have an inherit errors , i successfully added #import directive in my stdafx.h file with the full phyiscal path to my com file then i included stdafx.h into my stdafx.cpp file , then i compile
the studio generates for me a .tlh file but that file seems to have errors in it .
the following code in the generated .tlh file has the problem
<br />
struct __declspec(uuid("92d8ec9e-550e-4525-a858-c8601ad50703"))<br />
_VoiceNumbers : IDispatch<br />
{<br />
<br />
<big>__declspec(property(get=GetVoiceNumbers))<br />
_CollectionPtr VoiceNumbers;</big><br />
<br />
<br />
long Count ( );<br />
HRESULT Delete (<br />
long Index );<br />
HRESULT Add (<br />
struct _PhoneNumber * oAdd );<br />
_PhoneNumberPtr Item (<br />
long Index );<br />
IUnknownPtr NewEnum ( );<br />
_CollectionPtr GetVoiceNumbers ( );<br />
<br />
<br />
virtual HRESULT __stdcall raw_Count (<br />
long * _arg1 ) = 0;<br />
virtual HRESULT __stdcall raw_Delete (<br />
long Index ) = 0;<br />
virtual HRESULT __stdcall raw_Add (<br />
struct _PhoneNumber * oAdd ) = 0;<br />
virtual HRESULT __stdcall raw_Item (<br />
long Index,<br />
struct _PhoneNumber * * _arg2 ) = 0;<br />
virtual HRESULT __stdcall raw_NewEnum (<br />
struct IUnknown * * _arg1 ) = 0;<br />
virtual HRESULT __stdcall get_VoiceNumbers (<br />
struct _Collection * * _arg1 ) = 0;<br />
};<br />
the bolded code part has the problem and the following errors are
<br />
Error 1 error C2146: syntax error : missing ';' before identifier 'VoiceNumbers' d:\hitech work\jniwork\testingrex\testingrex\debug\resumemirror.tlh 893 TestingRex<br />
Error 2 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int d:\hitech work\jniwork\testingrex\testingrex\debug\resumemirror.tlh 893 TestingRex<br />
Error 3 error C2208: 'ResumeMirror::VoiceNumbers' : no members defined using this type d:\hitech work\jniwork\testingrex\testingrex\debug\resumemirror.tlh 893 TestingRex<br />
Error 4 fatal error C1903: unable to recover from previous error(s); stopping compilation d:\hitech work\jniwork\testingrex\testingrex\debug\resumemirror.tlh 893 TestingRex<br />
<br />
i am trying to make a wrapper for that com file to be able to call it from java using JNI technology .
each time i try to solve the errors , and compile again the studio generates for me another .tlh file as earlier one that has the same errors and i don't know what to do .
anyone has any solution for that please
Human knowledge belongs to the world.
|
|
|
|