|
This might be TOO easy for you, but,...
The DirectX 9 SDK (Summer Edition, and I suppose the latest download), has a Managed Version of the DirectX 9 DLLs. You can view the contents of the assemblies in the IL Disassembler; which makes for almost effortless usage. Just reference the assembly with the #using directive and set the correct search path for the Visual C++ .NET include and reference files directories, and your Intellisense should show you everything.
But, if you actually WANT to do it the hard way,...
|
|
|
|
|
Thats not a dumb suggestion ursus I hadnt thought of those new DLLs... didnt think MS
would go to all that trouble when they were planning on changing the managed code and
C++ anyway.
I'll give it a try.
And as an aside, the easy way is my ALWAYS my favorite way! Especially when dealing with MS
compilers hehe.
Thanks again...
Scott
|
|
|
|
|
|
I keep trying...
So after downloading and installing the latest version of DirectX SDK
with the included Managed Code additions and trying to link in the
Microsoft.DirectX.dll so that I can do as you suggested:
using namespace Microsoft::DirectX;
no amount of letting VS.Net know by way of "Additional Include Directories" can i get
it to recognize the namespace.
All I get so far is...
Microsoft::CSharp, Microsoft::VisualBasic, Microsoft::Win32.
I guess I'm mired in the old "Hard" ways of doing things I just dont understand.
Any help would be greatly appreciated.
Scott
|
|
|
|
|
I should have gone into greater detail (because I made the same mistake).
If you have your solution open in Visual C++ .NET, right click on the Project (which is just below the solution in the Solution Explorer). This will open the Dialog Box for setting search directories. You want to open the Property page and set the search path that Visual Studio uses to find include headers, LIB files, and .NET assemblies. Open the Projects folder. Select VC Project Directories and then select the List Box option (It's in the upper right corner) for Reference Files (the default is for the include files). There will be a text message displayed explaining that Reference Files are those that you include in your source code with the #using directive (these have DLL extensions). Then when the text box appears, you type in the path to the installed directory (on my Computer, it's: "C:\WINDOWS\Microsoft.NET\DirectX"). Or, use the Browse button.
You'll know when you've gotten it, because suddenly your Intellisense will be displaying your DirectX stuff.
If all that fails, you can, of course, copy the DirectX 9 Managed DLL and paste it into the current directory in which your Solution file resides.
Here's the MSDN info:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsintro7/html/vxurfVCDirectoriesProjectsOptionsDialogBox.asp[^]
|
|
|
|
|
I have an application in MFC that I have added some ADO.NET code to.
My DatabaseAccess class is unmanaged and has pointers to OleDbConnection which is used in the class member functions to manipulate the database.
I also have an unmanaged CFormView class that includes the DatabaseAccess class as a member.
I declared a pointer to the CFormView class so that other places in the code have access. CFormView * theDialog;
When I call the member functions in the DatabaseAccess classs, the OleDbConnection is checked for NULL to make sure the connection is there. All calls to the DatabaseAccess member functions work from the CFormView class.
When in CMainFrame on a timer I call theDialog->UpdateRecord() which in turn calls an OpenDatabase member of my DataAccess class, the check if(m_OleDb_connection != 0) causes an NullReferenceException to be thrown and the debugger shows that no instance of the connection has been assigned to the variable holding the OleDbConnection.
I thought this might have something to do with pinning or Threads. Any suggestions?
|
|
|
|
|
Sorry, just a bad pointer. theDialog was not set properly and was a bad reference.
|
|
|
|
|
In manged c++ code, I created several objects, and added them into a arraylist. Then I called a managed function and passed the arraylist as a parameter. In the c# side, I used the objects in the arraylist to invoke several events. I suppose that the garbage collector of c# would release the objects when they are done. But there is always memory leak somehow. Could anyone tell me why?
Thanx
|
|
|
|
|
BaseClass Interaction Problem
I have searched a lot on this problem to be able to resolve it, but have not found much more thing for and no solution was working like what I wanted.
My problem is this:
I have a program that have multiple class and I need a solid interaction between every class. To do it, I use FDataManager to stored all my data. When I need to get back the data and that I know which type is it, I can go though and process it. For that purpose, I use class, baseclass, friend and function overloading.
class CClassA
{
protected:
int VariableA
public:
CClassA() {};
friend FDataManager& operator>>( FDataManager& Ar, CClassA*& data )
{
Ar >> data->VariableA;
return Ar;
};
};
class CClassB
{
protected:
int VariableB
public:
CClassB() {};
friend FDataManager& operator>>( FDataManager& Ar, CClassB*& data )
{
Ar >> data->VariableB;
return Ar;
};
};
class CClassC : public CClassA, public CClassB
{
public:
CClassC() {};
friend FDataManager& operator>>( FDataManager& Ar, CClassC*& data )
{
Ar >> (CClassA*&)data >> (CClassB*&)data;
return Ar;
};
}; My problem is at line :
Ar >> (CClassA*&)data >> (CClassB*&)data;
I can solve it by doing this:
CClassA* data1 = (CClassA*)data;
CClassB* data2 = (CClassB*)data;
Ar >> data1 >> data2;
But I don't like that last solution. I need something similar at what I have done first. Also, yes (CClassA*&)data will work, but each time you will use it, you will get data corruption for all data that have stored in before.
Anyone have an idea?
|
|
|
|
|
|
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
|
|
|
|
|