|
Vaclav_Sal wrote: I have done some stupid things So have we all; it's a good learning experience.
|
|
|
|
|
Richard,
I spoke too soon.
Now I need to figure out how to unclude all the header files of SUBDIRECTORIES. I need the IVT library in debug mode.
Do I have to create my own parent #include file ( such as
stdafx.h) with all the other headers or is it a time to learn how to use CMake?
There is a Make file in the IVT stuff I dowloaded , but I never used Make.
Cheers Vaclav
|
|
|
|
|
Vaclav_Sal wrote: Do I have to create my own parent #include file ( such as stdafx.h) with all the other headers or is it a time to learn how to use CMake? I'm not sure what you mean, the two are not connected. Using pre-compiled headers via stdafx.h merely helps to reduce the compile time of your source files, but you still need to #include all the individual header files. I have used make in the past and it is a good system, but I don't think it offers any advantages when you are creating Windows applications. Using the VS build system will do all you need.
|
|
|
|
|
One of the bygone useful features of the ancient days before DOS programming vanished, was ability, when I wanted to calculate something quickly, to quickly write a program where control started at the beginning and ran down the text like in a knitting pattern and and I did not have to catch Windows messages and events. A short example follows at the end of this message. Please, how can I use Visual C++ to write and run such a program, and how to run it? (I have Windows Vista).
#include <stdio.h>
#include <std.h>
int F; char s[256],*nl="\n";
void v(int i,int j){sprintf(s,"%1d,%-3d %c%c%c%c ",i,j,0xc0,j,i,0xc0);
write(F,s,11);}
main(){int i,j; F=open("t$$",0x8002);
for(j=0;j<=84;j++) v(4,j); write(F,nl,1);
for(j=0;j<=34;j++) v(5,j); write(F,nl,1);
for(j=0;j<=234;j++) v(6,j); write(F,nl,1);
close(F);}
|
|
|
|
|
Just set your project to "Console application".
|
|
|
|
|
I am writing a Visual C++ program, using features from an from an older Visual C++ program which I wrote. How can I (for example) get the compiler to use the version of the standard function GetFileName(.....) which needs a char* parameter rather than the version which needs a WCHAR* parameter?
|
|
|
|
|
Actualy i don't understand your problem. will you please eloborate?
|
|
|
|
|
|
Check the project settings in your application, and if the Character Set says Unicode, switch to MBCS or Not Set. Alternatively use a properly constructed Unicode parameter.
|
|
|
|
|
|
|
Hi Community,
is there a Article about CFormView, CView, CListView etc. for Beginners?
I always work with dialog based Applications, so i don’t have any experience with this Classes.
Any help would be great for me.
Here i like to thanks to all who help me before in my problems .
regards
bosfan
|
|
|
|
|
|
Hi,
thanks for Answer and the URLs.
Best regards
bosfan
|
|
|
|
|
|
Hi,
thanks for sharing this url's
bosfan
|
|
|
|
|
|
Hello.
I just wrote a code in C++. It should calculate something but for it we need a external File. Now I have to type in the whole Path. That's annoying.
Is there a possibility to open an "openfiledialog"?
Now I have this code copied but it won't work-.-:
OPENFILENAME ofn; char szFile[1000]; HWND hwnd = GetConsoleWindow(); HANDLE hf;
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hwnd;
ofn.lpstrFile = szFile;
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = "All\0*.*\0Text\0*.TXT\0";
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
if (GetOpenFileName(&ofn)==TRUE)
hf = CreateFile(ofn.lpstrFile, GENERIC_READ,
0, (LPSECURITY_ATTRIBUTES) NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
(HANDLE) NULL);
Can you see there any mistakes or can you post a better code for it?
Is there even a possibility for it, but without using MFC or .NET?
Greets
PS: Sorry for my bad english. I'm from Germany.
modified 18-Jan-13 13:39pm.
|
|
|
|
|
What does won't work mean?
|
|
|
|
|
oh sry. I meant it doesn't work.
The compiler runs the Code and I get no errors. But it doesn't show the OpenFileDialog. Only the next command.
|
|
|
|
|
So you're getting to the CreateFile() method?
|
|
|
|
|
Just copied another code of the initalizon of the OPENFILENAME structure and it worked.
|
|
|
|
|
I have a Visual C++ workspace that has 2 projects (1 exe & 1 DLL).
I used Serge Wautier's tutorial ( Resource DLLs and Language Selection Menu[^] ) to create (multi-language) resource DLLs (satellite DLLs) branching off the exe.
Now I have a collection of strings in the DLL that are shared in other projects. I created a satellite DLL for that DLL but can't figure out how to load it on-demand just like the exe's satellite DLL.
He used:
HINSTANCE hDll = LoadLibrary(szFilename);
AfxSetResourceHandle(hDll);
void CLanguageSupport::UnloadResourceDll()
{
if (m_hDll!=NULL)
{
SetResourceHandle(AfxGetApp()->m_hInstance); // Restores the EXE as the resource container.
FreeLibrary(m_hDll);
m_hDll= NULL;
}
}
etc etc for the unloading/loading satellite DLLs for the exe.
but how to do the same for the DLL?
|
|
|
|
|
I think I got it working:
From VC2005 there's a function called AddResourceInstance() to chain DLLs. However am still using VC6 so this function doesn't exist.
So I just copied some code from a DLL project. The DLL main file contains these lines:
static AFX_EXTENSION_MODULE NEAR extensionDLL = { NULL, NULL };
DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
AfxInitExtensionModule(extensionDLL, hInstance);
new CDynLinkLibrary(extensionDLL);
}
This dynamically loads the DLL. If we put some of this code into the EXE project like so:
HINSTANCE hDll2 = LoadLibrary(szFilename2);
AfxInitExtensionModule(extensionDLL,hDll2);
new CDynLinkLibrary(extensionDLL);
After the AfxSetResourceHandle(hDll); //setting satellite DLL overriding EXE resources
Originally, the EXE would be the resource container, but AfxSetResourceHandle(satelliteDLL) will set loaded DLL as default resource container, overriding the EXE like.
We use the above extension DLL to chain (add-on) another resource DLL.
The only issues now is freeing the library/memory..
|
|
|
|
|
I am trying to compile libexif. Basically I have a requirement to read exif data from jpg.
In the README-win32.txt it is written as: "hack yourself a build system somehow. This seems to be the Windows way of doing things."!
I installed MinGW and Msys. I am able to get the Msys prompt. It ends up in a "$" prompt. I tried changing directory to where I have the libexif code from within this prompt unsuccessfully. My compile system is Win 7. msysCORE version is 1.0.11.
|
|
|
|