|
I figured probably that most Win32 API gurus hang out here, and anyway, I posted a question in the VB forum (since the app i am talking about is written in VB) and as much as I hate to cross-post, I think it is an API problem, so allow me to post a link.
Please help if you can. Would be much appreciated
The thread
--
David Wengier
|
|
|
|
|
I am using ShellExecute to open another program which is located in a subdirectory. I do this by calling it with the file param as the filename, and the directory name as the subdirectory. It works under win2k/xp/nt but not on win95/98/ME....If anyone knows why and how I can fix it it would be of amazing help!
So imagine the directory is 'stuff' and the file is 'thing.exe'
I call ShellExecute(NULL,NULL,"thing.exe",NULL,"stuff",SW_SHOW);
This works fine in 2k but not 9x!!!!!! please someone help me!
: Wherever you go, there you are, and you wish you were somewhere else :
|
|
|
|
|
did you add the Microsoft layer for unicode to your 9x project.
here is the text that is found at that link:
- Add the following two files to your project:
- UnicoWS.dll -- the Microsoft Layer for Unicode DLL
- UnicoWS.lib -- the LIB file to which you link
Note that the Microsoft Layer for Unicode does not automatically load from the $(WINDOWS) or $(WINSYS) directories. Thus, do not put UnicoWS.dll there unless you are running from a system process that is located there. Instead, keep the UnicoWS.dll in your application directory and call LoadLibrary yourself to ensure that you load the correct .dll.
- Add the following to the link options for your application (note that these libraries are not separated by commas because that is how you add them to the link list):
- First, add the following: /nod:kernel32.lib /nod:advapi32.lib /nod:user32.lib /nod:gdi32.lib /nod:shell32.lib /nod:comdlg32.lib /nod:version.lib /nod:mpr.lib /nod:rasapi32.lib /nod:winmm.lib /nod:winspool.lib /nod:vfw32.lib /nod:secur32.lib /nod:oleacc.lib /nod:oledlg.lib /nod:sensapi.lib.
- Then add UnicoWS.lib.
- Finally, add the libraries that the Microsoft Layer for Unicode uses explicitly: kernel32.lib advapi32.lib user32.lib gdi32.lib shell32.lib comdlg32.lib version.lib mpr.lib rasapi32.lib winmm.lib winspool.lib vfw32.lib secur32.lib oleacc.lib oledlg.lib sensapi.lib. In this step, omit any libraries listed after advapi32.lib whose APIs are not used in your application. However, if your application uses another component, such as MFC, ATL, or CRT, be sure to include any libraries on which the component depends.
- Compile your application.
There is other information on the Web page, I would follow the link from above.
Kilowatt
|
|
|
|
|
Use "open" as the verb, not NULL.
--Mike--
"COM didn't solve the old version of DLL hell - it just provided us with a new and improved version of hell."
-- John Simmons, 1/22/2002
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
if you are reading some input like this:
"JOHN 444-44-4444 Student"
and you want to create some object with those 3 variables>
how can you assign every detail to the right variable provided you have all the accessors and mutators?
thanx
|
|
|
|
|
sscanf
: Wherever you go, there you are, and you wish you were somewhere else :
|
|
|
|
|
can some one tell me please how do you write the return type of a function that would return an array of characters?
thanks in advance!
|
|
|
|
|
I am assuming you want a standard "c" style array.
In that case, your function prototype should look like this:
char* SomeFunction();
|
|
|
|
|
Matt Gullett wrote:
char* SomeFunction();
I'm not so sure. How would he know the number of elements? Unless the array is zero-terminated, but then he would call it a string and not an array of characters.
I vote pro drink
|
|
|
|
|
You are correct, he asked for an "array of characters" and I assumed he wanted a string.
To return an array with no predefined terminators or size, you could do one of several things.
1. Create a custom class to deal with it.
2. Instead of using a return value, use function parameters
void SomeFunction(char** pszValue, int& iLen);
This would be good if the function needed to determine the length and allocate the memory.
OR
void SomeFunction(char* pszValue, int iMaxLen);
This would be good if the function just needed a pre-exising array of max size.
3. Use a byte array and use the first N bytes to specify the length.
I am sure there are many other ways to do this also.
Matt Gullett
|
|
|
|
|
I guess technically speaking there is a difference. PASCAL strings i think have a runlength encoding byte at index zero. I've always considered them to be synonymous while using Visuall C++.
your bad is my bad brutha!
"An expert is someone who has made all the mistakes in thier field" - Niels Bohr
|
|
|
|
|
I want to copy/move a file to another dir, how?
What api to use?
------------------------------
©0d3 ©®4©k3® - That's me!
------------------------------
|
|
|
|
|
CopyFile or CopyFileEx to copy a file.
MoveFile or MoveFileEx to move a file.
|
|
|
|
|
TCHAR pszFrom[1024] = {0};
TCHAR pszTo[1024] = {0};
SHFILEOPSTRUCT shfo;
GetDlgItemText( IDC_SOURCE, pszFrom, 1024);
GetDlgItemText( IDC_DEST, pszTo, 1024);
ZeroMemory(&shfo, sizeof(SHFILEOPSTRUCT));
shfo.hwnd = AfxGetApp()->m_pMainWnd->m_hWnd;
shfo.wFunc = FO_COPY;
shfo.pFrom = pszFrom;
shfo.pTo = pszTo;
shfo.fFlags = FOF_NOCONFIRMATION | FOF_SILENT;
SHFileOperation(&shfo);
See MSDN for details...
"Needless redundancy is the hobgoblin of software engineering." - Peter Darnell
|
|
|
|
|
Yeah!
This was exactly what I was looking for!
------------------------------
©0d3 ©®4©k3® - That's me!
------------------------------
|
|
|
|
|
hello..
anybody can help me? Please help me to solve this error problem :
"error C2504: 'CRecordset' : base class undefined"
tq..
|
|
|
|
|
From MSDN
Compiler Error C2504
'class' : base class undefined
The specified base class was declared but never defined.
This error can be caused by a missing include file or an external base class that was not declared with the extern specifier.
The following is an example of this error:
class A; // error, A is undefined
class A {}; // OK, A is defined
class B : public A {}; // the error is detected here
You may need to include afxdb.h somewhere
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Picture the daffodil. And while you do that, I'll be over here going through your stuff.
Picture a world without war, without hate. And I can picture us attacking that world, because they would never expect it.
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
your solution =
put #include <afxdb.h> at the top of your file. and read your msdn next time.
: Wherever you go, there you are, and you wish you were somewhere else :
|
|
|
|
|
I have a server that runs on a configurable number of threads, that process incoming requests and write them to database. Is it advisable to use one OLE-DB connection using the CDataSource class to send all the concurrent database updates? My question is: does one SQL query on the connection block another, if SQL server itself does not cause locking? or put in different words, do the connection wait for one command to finish before starting another?
Thanks for any help ...
Thomas
modified 29-Aug-18 21:01pm.
|
|
|
|
|
Hello.
I posted a topic about GUI Programming a few days ago. I was trying to decide if I should go ahead and take a Visual Basic GUI Programming college course. I am most interested in C++ as most people have gotten from my comments on C++.
With the release of .NET, is Microsoft still using MFC for GUI? I would like to know what is the best approach to learning GUI Programming using C++ and still be able to implement GUI easily using .NET. In other words, I want to know what book(s) I should buy to learn GUI using C++ that would apply to .NET, if not emphasizes .NET.
Thanks,
Kuphryn
|
|
|
|
|
when focusing on .net (=winforms), use c#
Why?
1) It seems a lot easier:
visual studio .net does not have a winforms (.net gui) gui builder for c++ (manag. extensions) at all (what a shame!), whereas there is one for c# . (OR AM I TOTALLY BLIND ) Nevertheless, you can of course still use c++ as a fully qualified .net language.
2) c++ does still have superior features, but when it comes to targeting the .net platform for every-day programming, it is just-another.net-language, even though a good one..
On Win32, C++ always had the advantage of basically being superior to VB (especially regarding complexity just kidding).
mfc is basically for win32, does a good job (for win32 programmers). And will continue to do so as long as win32 is supported (which means like, hmm forever). Just one note: As a c++ programmer coming from Qt, I was actually shocked about the programming style. Since I wanted to deliver standard-compliant winapps I still chose mfc.
use c#
|
|
|
|
|
Thanks...an insightful message.
What is the difference between MFC and Win32 API?
Many members recommended Programming Windows, The Definitive Guide to the Win32 API -- by Charles Petzold and Programming Windows With MFC -- by Jeff Prosise. I believe the Petzold book emphasizes C, and not C++. That is the reason that is keeping me from considering buying that to strart GUI programming. As for Prosise's book, again, I do not know about the future of MFC with respect to .NET. I want to make sure that .NET and possibly future releases of popular C++ compilers such as Visual C++ and Borland C++ Builder will support MFC.
Ultimately, I want to stick with C++ as a primary programming language. I do not know until when, but I believe it will be a long,long time until someone design a language with the same low-level (C) and high-level (OOP) features like C++. With that said, what GUI programming technique using C++ will give me the most options now and in the future?
Kuphryn
|
|
|
|
|
MFC is a thin layer around the Win32 API.
Eventually becoming an MFC pro does imply knowing the Win32 API. For more complex thing in MFC, you just HAVE to know the Win32 API to make things happen.
Some People say MFC violates a lot of the principles of object-oriented programming, my personal experience is that it just doesn't offer any real abstraction.
Some people have written their own classes around the Win32 API because they got fed up, most do 70% of their things in MFC and hit Codeproject.com to find solutions to the remaining 30% the cannot figure out on their own without knowing Win32 (someone like ME )
It is simply a completely different thing writing ISO-C++ (but again, WHO does that) and using C++/MFC.
.NET is a platform, Win32 is a platform. Writing apps even in C++ for the .NET platform (winforms) is a lot more elegant, writing apps in C++ for Win32 using MFC (do not know WTL) forces you to know the insights = straight C Win32 API.
Sticking to C++ seems a rasonable decision, you can start programming winforms with c++ today, using managed extensions.
just my 2 cents
|
|
|
|
|
Is there any benefit to using .NET Framework over Win32 platform such as MFC? What do you mean by "elegant?" Are you implying, for example, 100 lines of code to 20 lines of code for the same job?
Kuphryn
|
|
|
|
|
For now I would strongly recommend learning C++ and then learning MFC for GUI work. Why ? Because there is a ton of free information on how to do it available ( look around you ). Also, you'll get a copy of VC6 pretty cheap now .NET is available.
I'm not saying don't ever learn .NET/C#, but I am saying that learning where there are a lot of resources will be much easier, MFC is not going away anytime soon, and once you've learned one, the other will be easier because of the basic principles you'll have under your belt.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Picture the daffodil. And while you do that, I'll be over here going through your stuff.
Picture a world without war, without hate. And I can picture us attacking that world, because they would never expect it.
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|