|
The Value's type is _variant_t
I tried to convert _variant_t to CString
<br />
_variant_t vari= ...;<br />
CString s;<br />
s = (LPCSTR)(_bstr_t)vari.bstrVal;<br />
but it doesnt show the right encoding, i think the problem is with UNICODE
but i dont know how to implement it.
thanks
|
|
|
|
|
Hello everyone,
About Template Partial Specialization,
http://www.cprogramming.com/tutorial/template_specialization.html
sometimes in real case like below,
http://www.sgi.com/tech/stl/iterator_traits.html
there will be two definitions at the same time,
<code>
template <typename T>
class Foo {
}
template <typename T>
class Foo <T *>
{
}
</code>
In theory, compiler will match the latter one with first priority compared with the 1st one.
My question is, I tihnk for basic data types it is easy to match,
example,
when we pass Foo <int*>, the latter one is matched and T is int. But for arbitrary data types, like used data types, how could compiler judge whether a type is pointer (when the latter template class should be matched) or not a pointer (when the first template class should be matched).
thanks in advance,
George
|
|
|
|
|
I guess it will depend on what you code inside. In extremis, it would be like a pointer void pBuf = NULL, you can get whatever you want with it, but afterwards to use it in another places you may have to cast the type. Maybe is not the best way, but is possible.
So that the template without parameter is just a void container that can hold whatever you give in, other thing will be how to use it after.
I like some of your questions, maybe I shouldn't answer if I don't know the answer for sure, but this way I learn too. Other people can correct/confirm me as well
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
Thanks Nelek,
I do not quite understand your points below. I think void pBuf = NULL should be void* pBuf = NULL? Please feel free to correct me if I am wrong.
And it is appreciated if you could provide some pseudo-code to show your points below. A couple of lines of code is more effective for a large section of literal description for developer.
Nelek wrote: In extremis, it would be like a pointer void pBuf = NULL, you can get whatever you want with it, but afterwards to use it in another places you may have to cast the type.
regards,
George
|
|
|
|
|
Because the Setup and Deployment project doesn't allow me to execute a batch file (why, is beyond me) I am making a simple c program to execute the batch file. Now its been a while since I've used C so after reading a little bit here is what I have.
<br />
#include <stdio.h><br />
#include <stdlib.h><br />
<br />
int main(int argc, char * argv[])<br />
{<br />
system("setsdwperm.bat " + *argv[1]);<br />
}<br />
I got the project on the add new project dialog: Visual C++ -> General -> Empty Project
When I look at the project properties under configuration properties it says Configuration Type is Application (.exe). But no .exe is produced when I build it. I get a log file, manifest, obj, dep, idb, and pdb files. What other setting do I need to change?
|
|
|
|
|
eggsovereasy wrote: system("setsdwperm.bat " + *argv[1]);
oh my god !!!
when you want to concatenate strings, you mustn't use the + operator !!! you have to use strcat() .
moreover, system() is deprecated if you're targetting your code for a given plateform (for Windows, you should prefer ShellExecute() or CreateProcess() for instance).
|
|
|
|
|
Ok, everything I try throws exceptions and I can't use the debugger with it?
Any suggestions on how I would do this? all I need to do is combine "setsdwperm.bat " with the first argument and execute it.
|
|
|
|
|
#include <stdio.h>
#include <stdlib.h>
int _tmain(int argc, TCHAR* argv[]) {
TCHAR pszBuffer[256] = {0};
strcpy(pszBuffer, _T("setsdwperm.bat"));
strcat(pszBuffer, argv[1]);
ShellExecute(NULL, _T("open"), pszBuffer, NULL, NULL, SW_SHOWNORMAL);
}
an even more easy way is this:
#include <stdio.h>
#include <stdlib.h>
int _tmain(int argc, TCHAR* argv[]) {
ShellExecute(NULL, _T("open"), _T("setsdwperm.bat"), argv[1], NULL, SW_SHOWNORMAL);
}
-- modified at 13:22 Monday 19th November, 2007
|
|
|
|
|
Probably you are looking at the wrong place ([ADDED]provided you didn't make errors, see toxcct reply...).
You ca check the value of the 'Output Directory' setting inside the 'Configuration Properties->General' window (Menu Project Properties).
Or, if you prefer, you can check it in the linker command line (/OUT option).
By default (I'm talking about VS2005) the executable is inside the 'debug' (or 'release') subfolder of the solution one.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Yeah, with C# projects it puts all the compiled files in Solution Dir\Project Dir\Output Dir, but with this it was in Solution Dir\Output Dir.
Thanks.
|
|
|
|
|
how to open .tif file in VC++ MFC from file menu?
|
|
|
|
|
What's giving you trouble? The menu part? Opening a file?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
i am able to open the .tif file in OnDraw using libtiff library. But i want to open it from file open menu. it requires pDC to open. How to open from file open menu?
|
|
|
|
|
Opening the file has nothing to do with a DC or pDC.
Are you trying to work with a TIFF file without a 3rd party library?
If so, here's a couple options...
1) Use GDI+...
<font color="Green">
</font>void CMyView::OnDraw(CDC *pDC)
{
Gdiplus::Bitmap bitmap(L"C:\\test.tif", FALSE);
Gdiplus::Graphics graphics(*pDC);
graphics.DrawImage(&bitmap, 0, 0, bitmap.GetWidth(), bitmap.GetHeight());
}
2) Study the TIFF specification[^] and write code to parse the TIFF file.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I want to know, how many time I compile my application, for make the version detail in the program.
what's the function can support this issue.
Please advise.
|
|
|
|
|
Refer to
http://support.microsoft.com/kb/237870#appliesto
Regards
Bhawna
|
|
|
|
|
Hi,
I am facing a build issue in my PC, with Microsoft Visual Studio-6.0. When i go for a build from the VC++ ide, the build gets stuck while running the link.exe or lib.exe files. When i click on Stop Build button, there is no effect. And I cannot close the ide also, it says "build in progress". i need to explicitly kill process MSDEV.exe from task manager. This issue observed only in my machine(not in any other machine). I am using Dell machine, Gx280 model, with Pentium-4 , 2.8 Ghz and 1GB RAM.I reinstalled Visual Studio, but still the problem persists.
Please suggest a solution.please please
Syam
SYAMLAL
|
|
|
|
|
Does it happen for every project, or just a particular one?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
It happens for all projects. Evenif i try a sample application also, it will give this problem.
Sometimes i am running build scripts for building all the executables, related to my project. Then it gets stuck in between.
Thanks,
Syam
SYAMLAL
|
|
|
|
|
Things to try: switch off incremental linking in the project settings, delete all the temporary generated files associated with the project .obj .ncb etc. Then do a full rebuild from scratch. This usually clears the blockage as it were.
Like any complex product Visual Studio is far from bug free and some of these can cause the linker to sit in an endless loop. I have to have the intellisense Dll excised from my VS 2005 installation because one of my projects causes intellisense to consume 98% of the processing power endlessly. Such is life
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
iam trying to scroll the controls in a dialog.
i used ScrollWindow(....). to achieve this.
i gave ctrl+down and up arrow keys to scroll up or down.
till here no problem.
but when i drag the slider available on the right side of the dialog, down or up, the controls are getting scrolled(obviously after some coding) but, the slider is moving back to its initial position.
any ideas?
to brief my problem,
i want the slider in my dialog to stand at the place where i have left it, and also i should be able to get its position.
thaks for any help.
|
|
|
|
|
Does Get/SetScrollPosition (...) helps?
I mean, when you click down and moving the mouse you use Get... to know where the viewport is, then when you release he button use Set... with the last ScrollPosition value.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
thanks nelek for your response.
but iam unable to know the bar id (nbar) of the scroll bar.
please note, i ve checked the "Enable Vertical Scroll" property of the dialog.
if possible, please do me a favour.
take a dialog based application in vc6.0,
enable the scroll bar option in that,
then try dragging the scroll bar and see.
now you can easily understand my problem and iam sure you can solve it.
please do this for me my friend, because iam stuck up there, and unable to deliver the application to the client.
thank you.
if required, i can send my source code to you.
|
|
|
|
|
Hi,
i know that this is not a C++ Message but since C/C++ developers have the best experience in software / driver development, i will ask my question here. I installed Services for Unix from Microsoft on my System and now i found something very strange. Whenever the (Core) Driver named rpcxdr.sys tries to start it makes my system go BSOD. I had to disable the driver to render my system to normal state back. So i made a Memory Dump of the BSOD and analyzed it with "!analyze -v" inside the windows debunng tool. The Result is clear, but can this be considered as a real bug? What do you think? Here is a link to the DBG result. See for yourself:
http://entwicklung.junetz.de/tmp/rpcxdr.sys_BAD_POOL_HEADER.txt[^]
Thanks in advance,...
---------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
kerem.g@arcor.de
Best Quote: "Ain't nobody a badass with a double dose
of rock salt...", Kill Bill Vol.2
Microsoft Live Space: http://kerem-g.spaces.live.com/
Latest Open-Source Projects
Tools and Software: http://entwicklung.junetz.de
Sign my guestbook: http://entwicklung.junetz.de/guestbook/
-----------------------
"This reply is provided as is, without warranty express or implied."
|
|
|
|
|
I have some problems that are a little hard to explain, but I will try my best. I am trying to write a dll that will be called by an Excel VBA macro. The dll communicates with a barcode scanner and generates an event when a reading has completed. All communications between the VBA code and the dll are working perfectly. The manufacturer of the barcode scanner provided a sample mfc stand-alone (NOT dll) application with source code and I am now trying to convert that source code into a dll with no GUI. The main code (the event handling, the communications with the scanner, etc) resides within a class that inherits a CDialog. Begin message map looks like this:
BEGIN_MESSAGE_MAP(CBarcodeScannerDemoDlg, CDialog)
ON_BN_CLICKED(IDC_ReadCodes, OnReadCodes)
ON_WM_DESTROY()
ON_MESSAGE (WMU_NEW_CODE_AVAILABLE , OnNEW_CODE_AVAILABLE)
ON_MESSAGE (WMU_START_THREAD , OnSTART_THREAD)
ON_MESSAGE (WMU_STOP_THREAD , OnSTOP_THREAD)
ON_MESSAGE (WMU_KILL_THREAD , OnKILL_THREAD)
END_MESSAGE_MAP()
Thus, when the IDC_ReadCodes button is pressed, OnReadCodes is executed. Since I want a GUI-less dll, I really don't need to inherit the CDialog, but what should I inherit instead? If I just create new a class to put the main code in, what should I replace CDialog with in the BEGIN_MESSAGE_MAP macro above? I am a beginner C++ developer, please have that in mind when replying. If you need further information or clarifications, please don't hesitate to reply. Any help would be greatly appreciated.
|
|
|
|
|