|
in visual c++ 2002 i created a win32 application... (unmanaged).. how do i make a button, dialog, textbox, etc? i've programmed in c# before but i know that is nothing like unmanaged c++. i have "c++ for dummies" and i hope that will help me but i dont want to make console applications, i want to make windows applications. i need to know where to start. thanks in advance.
|
|
|
|
|
What about MFC? Just create a MFC application and you can create your forms similiar to the way you do it in C#.
If you want it the hard way, do all your API calls like "CreateWindow" by yourself.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi - a Win32 project is perhaps the most difficult type of project to get together. Basically, you want to create an MFC project, MFC is a library that sits on top of Win32 and makes things a lot easier.
However, C++ is more complex ( and also more powerful ) than C#. I'd recommend you first do some console programming to learn the language, then buy a good MFC book before continuing.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Im relatively new to programming and have never come across a memory leak problem before and cant seem to figure out how to fix the problem. For some reason I have this memory leak
memory check error at 0x000349C0 = 0xFF, should be 0xFD.
memory check error at 0x000349C1 = 0x00, should be 0xFD.
memory check error at 0x000349C2 = 0x03, should be 0xFD.
memory check error at 0x000349C3 = 0x00, should be 0xFD.
Detected memory leaks!
Dumping objects ->
C:\Program Files\Microsoft Visual Studio\MyProjects\Mandelbrot\MandelbrotDoc.cpp(20) : {61} client block at 0x00034550, subtype 0, 1136 bytes long.
a CObject object at $00034550, 1136 bytes long
plex.cpp(31) : {60} normal block at 0x00034498, 124 bytes long.
Data: < C > 00 00 00 00 00 00 00 00 00 00 00 00 F0 43 03 00
{59} client block at 0x00032A58, subtype 0, 32 bytes long.
a CDocManager object at $00032A58, 32 bytes long
c:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\MYPROJECTS\Mandelbrot\Mandelbrot.cpp(78) : {58} client block at 0x000343F0, subtype 0, 108 bytes long.
a CSingleDocTemplate object at $000343F0, 108 bytes long
strcore.cpp(118) : {56} normal block at 0x00032A00, 19 bytes long.
Data: < File> 01 00 00 00 06 00 00 00 06 00 00 00 46 69 6C 65
strcore.cpp(118) : {55} normal block at 0x00032998, 29 bytes long.
Data: < Rece> 01 00 00 00 10 00 00 00 10 00 00 00 52 65 63 65
{54} normal block at 0x00032940, 20 bytes long.
Data: < M_ M_ M_> 04 00 00 00 14 0B 4D 5F 14 0B 4D 5F 14 0B 4D 5F
{53} normal block at 0x000328D8, 32 bytes long.
Data: < K_ D) ) > CC AD 4B 5F 04 00 00 00 44 29 03 00 A4 29 03 00
Object dump complete.
The thread 0xFC6C has exited with code 3 (0x3).
The program 'C:\Program Files\Microsoft Visual Studio\MyProjects\Mandelbrot\Debug\Mandelbrot.exe' has exited with code 3 (0x3).
It says my leak lies here
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CMandelbrotDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CMandelbrotView));
AddDocTemplate(pDocTemplate);
and here
IMPLEMENT_DYNCREATE(CMandelbrotDoc, CDocument)
BEGIN_MESSAGE_MAP(CMandelbrotDoc, CDocument)
//{{AFX_MSG_MAP(CMandelbrotDoc)
ON_COMMAND(ID_APPIDLE, OnAppIdle)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
If you need more info to help me out just let me know. Thanks.
|
|
|
|
|
Looks to me like your program has not ended normally ( for example, you were debugging and just stopped without letting the program end ). The code in question is created by MFC, so unless you're underlying document object is leaking memory, I don't see how you can have done anything to cause it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Evil_Twin wrote:
memory check error at 0x000349C0 = 0xFF, should be 0xFD.
memory check error at 0x000349C1 = 0x00, should be 0xFD.
memory check error at 0x000349C2 = 0x03, should be 0xFD.
memory check error at 0x000349C3 = 0x00, should be 0xFD.
This means that you have corrupted your heap in some way. Is it possible that you have stepped outside the bounds of an array?
John
|
|
|
|
|
Hi,
I have many problems with pictures inserted in my documents after I compile them in Html Help Workshop. Sometimes the pictures are nt shown.
Anyone knows if this is a bug?
Thanks
|
|
|
|
|
a_kiani wrote:
Sometimes the pictures are nt shown
Sounds more like the problem is with the path to the pictures. As you are aware HTML help is nothing more than a bunch of web pages compressed into one file. One easy way to make sure they all look the way the pages are suppose to is open them individually with internet explorer.
-------------------------------
DEBUGGING : Removing the needles from the haystack.
|
|
|
|
|
Set the image path relative to the base path and if it still happens, try to add the "BASE HREF" statement to set this base path.
Marc Soleda
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
I'm working on a MFC application. I want to have some kind of a key mapper. I want to be able to convert key codes to the keys name - if for example the user presses "backspace", "Backspace" is displayed in some edit field.
Is there any easier way to do this than to set up a gigant switch and/or STL map, or is there even a pre-defined map or something like that?
You don't want to do work more that you have to!
|
|
|
|
|
Gadjuka wrote:
gigant switch and/or STL map
A switch is hideous. A map is made for this sort of thing. How huge can it be, anyhow ? I've built much bigger maps than this.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
In MSDN: There is GetKeyNameText.
|
|
|
|
|
That was exactly what I was looking for!
Thank you very much!
|
|
|
|
|
Could you tell me what books like Real World .NET Application ?
The book has some good application for learning.
Thanks in advance
|
|
|
|
|
How to use CByteArray to store large data into Oracle database.
|
|
|
|
|
dear friends,
I'd a problem. I want to instatite a template class like this
MaxHeap<Array<int>> m; I'm using vc++. Why it is so. The code is working if i'm changing code and using like MaxHeap<Array> m;Why it is so. How to solve this problem. Please help me in this aspect.
But compiler is giving errors like
Compiling...
heap.cpp
d:\cpppractice\sep3\heap.cpp(13) : error C2146: syntax error : missing ',' before identifier 'm'
d:\cpppractice\sep3\heap.cpp(13) : error C2065: 'm' : undeclared identifier
d:\cpppractice\sep3\heap.cpp(13) : error C2143: syntax error : missing '>' before ';'
Error executing cl.exe.
heap.obj - 3 error(s), 1 warning(s)
complete code is:
# include <iostream>
# include <Heap1.h>
using namespace std;
using namespace bhadram1;
int main()
{
int array[10]={20,12,35,15,10,80,30,17,2,1};
Array<int> a(array,10);
Array<int> a1(a);
MaxHeap<Array<int>> m;
//m.initilize(a,10,10);
//m.print();
return 0;
}
# include <iostream>
using namespace std;
namespace bhadram1
{
template<class T>
class Array
{
//friend ostream& operator<<(ostream& ostr,String& s);
protected:
int size;
T* data;
public:
Array()
{
size=1;
data=new T[1];
}
Array(int n)
{
size=n;
data=new T[size];
}
Array(int* a,int const s)
{
size=s;
data=new T[size];
for(int i=0;i<s;i++)
{
data[i]=*a++;
cout<<data[i]<<endl;
}
}
Array(Array<T>& a)
{
size=a.size;
//delete[] data;
data=new T[size];
for(int i=0;i<size;i++)
{
data[i]=a.data[i];
}
}
T& operator[](int i)
{
return data[i-1];
}
};
template<class T>
class MaxHeap
{
private:
int currentSize,maxSize;
public:
MaxHeap()
{
currentSize=0;
}
void initilize(T a,int size,int arraySize)
{
T heap(size);
for(int j=1;j<=10;j++)
{
heap[j]=a[j];
cout<<heap[j];
}
currentSize=size;
maxSize=arraySize;
for(int i=currentSize/2;i>=1;i--)
{
int y=heap[i];
cout<<"a "<<a[i]<<" y "<<y;
int c=2*(i);
cout<<"c "<<c<<" current "<<currentSize<<endl;
while(c<=currentSize)
{
cout<<"sub c "<<c<<endl;
if(c<currentSize && heap[c]<heap[c+1])
c++;
if(y>=heap[c])
break;
heap[c/2]=heap[c];
c*=2;
}
heap[c/2]=y;
}
for(i=1;i<=10;i++)
{
cout<<"final "<<heap[i]<<endl;
}
}
void print()
{
}
};
};
Thanking you,
yours sincerely,
bhadram
bhadram
|
|
|
|
|
>>MaxHeap<array<int>> m; I'm using vc++. Why it is so
Because you need to pust a space between >>
Example:
MaxHeap<array<int> > m;
It'll work if you put the space in. The space is required, because the compiler see this >> as operator >> (instead of template brackets).
Top ten member of C++ Expert Exchange.
http://www.experts-exchange.com/Cplusplus
|
|
|
|
|
Hi,
I have a MDI project.
How can I exchange data from one Editcontrol to another editcontol. I open two instances of a view.
I change the text of the Editcontrol in one view.
Afterwards, I close the view. The changed text should appear to the second view in the Editcontrol.
Can you help me please?
Klef
|
|
|
|
|
Hi,
You may use the CDocument::UpdateAllView method.
This will call the OnUpdate method of all view instances which are currently displaying the same CDocument object.
Eric
"If it is not broken, do not fix it"
|
|
|
|
|
Hi,
Thank you for your answer.
Is there in the forum possibly an example which I could look at myself the thing times?
Best regards
|
|
|
|
|
I want to use VC++ *.lib into C# application. I know that I must compile the lib in to a dll. How can i do that? Any method and hits to me.
|
|
|
|
|
IMO, the easiest way is to create a DLL that exports functions that simply call the .LIB functions:
BOOL __stdcall fooFunc_DLL(int p)
{
return fooFunc_LIB(p);
}
that way, you don't have to change the .LIB functions, and the DLL is a simple one-step pass through.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
I suggest you start reading here[^] in the MSDN about DLL's. In order to use your object library (the .lib file) as a DLL, you may need to create a DllMain function in a .C or .CPP source file, compile it, and link it to your .lib.
You will need to research further what it takes to use a DLL from C#; that's something I don't know about.
By the way: I don't know who the two boneheads were that rated your post a 1. I think your question is valid, asked politely, and in the correct forum. Good luck.
Software Zen: delete this;
|
|
|
|
|
Hi
I am using SQL Server for my database programming using CRecordset. but now i have to use Oracle. I am connecting to Oracle using ODBC. How to access tables from Oracle. Tables having BLOB datatype fields. how to access Oracle through VC++. Can u plz guide me.
Thanks in advance.
|
|
|
|
|
Hello,
You can use CDatabase and CRecordset classes for accessing the database and retrieving the records from Oracle. While passing any query when you mention the table name is sufficient, as the ODBC will be connecting to the whole of the database and tables are part of the database.
If the reply helps you, Don't forget to rate it.
|
|
|
|