|
|
Umm, you have tried it?
Because I'm getting an error with your code (Compiled with VC++ .NET 2003):
c:\Documents and Settings\Administrator\Desktop\MyProject\MyProject1\MyProject1.h(31) : error C2679: binary '>>' : no operator found which takes a right-hand operand of type 'CClassA *' (or there is no acceptable conversion)
|
|
|
|
|
do you provide a (cast) operator in your classes ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Problem solved. Thx again.
Here is my simple solution as stupid as it be and you was very near, just some work arround:
My solution:
*(CClassA**)&data
The current code that I used in my exemple:
Ar >> (CClassA*&)data >> (CClassB*&)data;
Will be transformed in:
Ar >> *(CClassA*)&data >> *(CClassB**)&data;
And to answer to your last question; no, I didn't have any (cast) operator defined in my classes.
|
|
|
|
|
Hi,
How do I set some RadioButtons into one group ?
If anyone know of a good article on working with RadioButtons it would be gr8 if you could refer me to it.
thanks,
yaron.
|
|
|
|
|
Hey folks:
I have a map which contains a string and another map. The inner map tracks vector types (ascending, descending, random, oneValue) and the time it takes to sort that type. i need to isolate the fasted time for each type of vector. The outer map contains the different sort types(quickSort, insertionSort, etc).
i have the type isolated but im having trouble isolating and comparing the times. This is what i have so far:
void PrintMap(const sortType& sType)
{
for(sortType::const_iterator it = sType.begin(); it != sType.end(); ++it)
{
for(sMap::const_iterator innerIt = it->second.begin(); innerIt != it->second.end(); ++innerIt)
{
if(innerIt-first == "Random")
{
cout << it->first << " with " << innerIt->first << " vector, time: " << innerIt->second
<< endl;
}
}
}
}
innerIt->second represents the time in question. There are four different types of vector arragements for each sort. i need to find the fasted for each sort and print them to the console.
if anyone has any thoughts id appreciate it.
Thanks,
Phil
|
|
|
|
|
I suspect you'll get more viewers in the C++ forum
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Hi,
Note: I understand that this forum is generally for Managed C++ question, but since there was no forum devoted to assembly I am posting this thread here, and hoping someone will answer.
This question is regarding the SSE macro function for shuffle operations. I don't understand it fully.
MSDN says that _MM_SHUFFLE(z,y,x,w) expands to :
(z << 6) | (y <<4) | (x << 2) | w
This macro is used in conjunction with SHUFPS or MMX instrinsic function _mm_shuffle_ps(m1, m2, int mask), where mask is replaced by the macro that acts on m1 and m2. m1 and m2 are 128 bit registers.
MSDN has the following example:
Let m1 be a : b : c : d
Let m2 be e : f : g : h
where each of the a,b,c,d,e,f,g,h are 32 bit single precision floating point values. a is the highest double word and d is the lowest double word. Similarly, e is the highest double word and h is the lowest double word.
Now, when the following function is performed on the m1 and m2 MMX registers:
_mm_shuffle_ps(m1,m2,_MM_SHUFFLE(1,0,3,2))
we get
m3 g : h : a : b
-------------
Working
I tried to work this example myself but couldn't arrive at the right answer.
1 << 6 gives 0100 0000
0 << 4 gives 0000 0000
3 << 2 gives 0000 1100
2 gives 0000 0010
Bitwise OR operation gives 0100 1110
If we apply this mask on m1 and m2 how do we end up with m3? What am I doing wrong here. Any insights will be most helpful.
Thank you
Swati
|
|
|
|
|
Hello,
I need to clear the screen from text, how can I do that?
This is a DOS C++ program so its in a "Cmd" envirement.
|
|
|
|
|
Even if you are using managed c++, you can still use system("cls")
like the following:
#include "stdafx.h"
#using <mscorlib.dll>
using namespace System;
int _tmain()
{
// TODO: Please replace the sample code below with your own.
Console::WriteLine(S"Hello World");
system("cls");
Console::WriteLine(S"Clear");
int rs = System::Console::Read();
return 0;
}
|
|
|
|
|
Haven't received any reply to a question I posted a few weeks (or more) past, so will try again... anyone out there using the 2005 beta? If so have you found that the IDE doesn't highlight and redirect focus to the statement in error when you click on the error message? This may be a problem with the beta, but maybe I have overlooked some setup option. Anybody have the same problem, or a solution (other than discontinuing usage of the beta!)?
TFB
|
|
|
|
|
I found this problem, too. I have to comment out codes line by line...
Anyway, better to seperate functions to different classes( and files) to find the problem more quickly.
http://blog.joycode.com/jiangsheng
http://blog.csdn.net/jiangsheng
Command what is yours
Conquer what is not
---Kane
|
|
|
|
|
The errors do have line number references, so better than nothing, eh? Maybe you already know... the Beta-2 is available for download, or cd ordering (msdn web site). Maybe the ide will be more useful!
|
|
|
|
|
Hi,
So I am programming in C++ to access office documents in the background (so nothing is visible)
It's important that I don't get any visible notifications or pop-up windows.
Now working with Powerpoint and Excel gives no problem.
But if I try to open a Word document that allready is open I get this annoying messagebox "Open as Read Only - Notify - Cancel"
This messagebox should NOT appear because I set the "DisplayAlerts" - property of the Word application to false
Plus I explicit say to open the document as "read only"
If I run a macro (vb) with these requirements I don't get any messages but in C++ I do
Here's the code in c++
dhCheck( dhCreateObject(L"Word.Application", NULL, &wdApp) );
dhPutValue(wdApp, L".Visible = %b", FALSE);
dhPutValue(wdApp, L".Assistant.On = %b", FALSE);
dhPutValue(wdApp, L".DisplayAlerts = %d", 0);
dhGetValue(L"%o", &wdDoc, wdApp, L".Documents.Add");
dhGetValue(L"%o", &wdDoc, wdApp,
L".Documents.Open(%s%b%b%b%s%s%b)", inpath, FALSE, TRUE,
FALSE, "", "", TRUE);
NOTE that I explicit set the DisplayAlerts to False (0)
PLUS that I open the file as READ ONLY
So I really don't understand
1: why I still get A message
2: why I am asked again to open the file as read only after I allready
explicit told the application to do so
It's really important that I find a solution or at least a decent explanation
Hopely someone can help me here
christophe.keteleer@gmail.com
|
|
|
|
|
I'm a little confused,...what are the dhPutValue and dhGetValue names? Wrapper classes? If this was a Visual C++ .NET application, you'd be using Interop to operate the Word Application object. Are you just opening ONE Word Application?
I would guess that some default value is overriding your DisplayAlerts setting; the Word type library is so humongeous that,...well, you know,...I'm lazy.
|
|
|
|
|
Perhaps some of you who are more experienced with Windows programming could answer this question for me. I have the ability to access values in the Windows registry but when I try to access a variable which holds path information, I get an "Access Denied" error. The variable I am trying to read is HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\History. I'm using RegOpenKeyEx and RegQueryValueEx to read the value but I must be missing something here. This is the code I'm using.
void ShowError()
{
LPVOID lpMsgBuf;
if (!FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPTSTR) &lpMsgBuf,
0,
NULL ))
{
// Handle the error.
return;
}
// Process any inserts in lpMsgBuf.
// ...
// Display the string.
MessageBox( NULL, (LPCTSTR)lpMsgBuf, "Error", MB_OK | MB_ICONINFORMATION );
// Free the buffer.
LocalFree( lpMsgBuf );
}
BOOL GetHistoryFolder()
{
HKEY hKey;
char szHistory[100];
DWORD dwBufLen=100;
LONG lRet;
LPDWORD Type;
lRet = RegOpenKeyEx( HKEY_CURRENT_USER,
"Software\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders",
0, KEY_QUERY_VALUE, &hKey );
if( lRet != ERROR_SUCCESS ) {
ShowError();
return FALSE;
}
lRet = RegQueryValueEx( hKey, "History", NULL, (LPDWORD) &Type, (LPBYTE) szHistory, dwBufLen);
if( (lRet != ERROR_SUCCESS) || (dwBufLen > BUFSIZE) ) {
ShowError();
if (Type == (LPDWORD)REG_SZ)
printf("Type is REG_SZ\n");
else
printf("Type is %ld\n",Type);
return FALSE;
}
RegCloseKey( hKey );
printf("History is [%s]\n",szHistory);
return(TRUE);
}
Please help!
Rex
|
|
|
|
|
I guess I figured it out, thanks for considering helping me.
|
|
|
|
|
Hi,
We are developing KIOSK applications for banks. In our KIOSKS, we are using Panasonic KX-7100 printers. If you have ever seen a KIOSK application, no window or dialog box except the ones that are belong to related application is allowed to appear. So we must restrict printer related dialog boxes and error windows inside our applications. For example when paper finished, printer shows a “Printer Status Display” window .
How can we understand out of paper error inside our application not to show this window, but our own dialog box? There is a class called Win32_printer, but i coulnt find any sample code. Is there anybody that can help me?
|
|
|
|
|
Hi All,
I am working on a project which deals with diffgram files.I am facing a problem to store the values of elements from the diffgram file to a database table.I can create the database table but how to store the values from difgram to those tables lies the challenge ahead of me.
Can anybody send me link or the code snippet for this.
Thanks a Million.
Gaurav
|
|
|
|
|
I need to convert a char *test; to a int.
how can I do that?
|
|
|
|
|
Converting char to int is implicit. Converting a string to an int is simple - use atoi.
BTW, this is not the C++ forum.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Here is convertion from char to int
char t = '7';
int i;
i = atoi( (CString)t );
//now i is 7;
m0n0
|
|
|
|
|
|
Why on earth do you cast to a CString ?
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Hail Programmers
I am trying to compile a VC++Net2003 Project that includes the following struct:
typedef struct xlref<br />
{<br />
WORD rwFirst;<br />
WORD rwLast;<br />
BYTE colFirst;<br />
BYTE colLast;<br />
} XLREF, FAR *LPXLREF;
The compiler chokes giving the following error message:
"c:\call.h(28) : error C2146 : syntax error : missing ';' before identifier 'rwFirst'"
MSDN suggests that this error occurs "as a result of compiler conformance work that was done for Visual Studio.Net 2003: explicit specialisations no longer find template parameters from primary template."
If anyone speaks MSDN, I'd be grateful if could you tell me how I fix the struct?
Regards
Jeremy
|
|
|
|
|