|
if images are imported/used in resX using imagelist.
how do i store audio clips in the application resources? do i use app.rc for that?
also i would like to embed icons in it also. how and where do i store them?
thanks.
|
|
|
|
|
ok i think i have figured out how resX works.
thanks.
|
|
|
|
|
Yup, I did Google but nothing helped. I get strange linker errors.
Error 1 error LNK2001: unresolved external symbol "extern "C" int __cdecl wsprintfW(wchar_t *,wchar_t const *,...)" (?wsprintfW@@$$J0YAHPA_WPB_WZZ) ComPort.obj Lab1
Error 2 error LNK2001: unresolved external symbol "extern "C" long __stdcall RegQueryValueExW(struct HKEY__ *,wchar_t const *,unsigned long *,unsigned long *,unsigned char *,unsigned long *)" (?RegQueryValueExW@@$$J224YGJPAUHKEY__@@PB_WPAK2PAE2@Z) Lab1.obj Lab1
Error 3 error LNK2001: unresolved external symbol "extern "C" long __stdcall RegQueryInfoKeyW(struct HKEY__ *,wchar_t *,unsigned long *,unsigned long *,unsigned long *,unsigned long *,unsigned long *,unsigned long *,unsigned long *,unsigned long *,unsigned long *,struct _FILETIME *)" (?RegQueryInfoKeyW@@$$J248YGJPAUHKEY__@@PA_WPAK22222222PAU_FILETIME@@@Z) Lab1.obj Lab1
Error 4 error LNK2001: unresolved external symbol "extern "C" long __stdcall RegEnumValueW(struct HKEY__ *,unsigned long,wchar_t *,unsigned long *,unsigned long *,unsigned long *,unsigned char *,unsigned long *)" (?RegEnumValueW@@$$J232YGJPAUHKEY__@@KPA_WPAK22PAE2@Z) Lab1.obj Lab1
Error 5 error LNK2001: unresolved external symbol "extern "C" long __stdcall RegOpenKeyExW(struct HKEY__ *,wchar_t const *,unsigned long,unsigned long,struct HKEY__ * *)" (?RegOpenKeyExW@@$$J220YGJPAUHKEY__@@PB_WKKPAPAU1@@Z) Lab1.obj Lab1
Error 6 fatal error LNK1120: 5 unresolved externals Lab1
The linker throws errors only in a Release configuration. In a Debug conf the project compiles successfully.
If I comment out lines where I use the functions above, the code compiles. But certainly is not what I want.
What's interesting, I use other functions from WinAPI and they work. Also wscanf_s compiles with no errors.
Also, wiping .obj files out (and all other which are generated during compilation) does not help
Thanks in advance --
Greetings - Jacek
|
|
|
|
|
Release -> Project properties -> Config -> Linker -> Input -> Additional Dependencies -> remove "NoInhert".
Phew... I had spent 3 hours searching and only after posting on CP I solved the problem. Thank you!
Greetings - Jacek
|
|
|
|
|
Here is my setup.
- c# wrapper calls managed c++ API code
- managed c++ calls unmanaged API code (c++ compiled with the /clr flag, located in the same project) using static funtions
- API tries to instantiate object defined in another dll (native c++)
void Screen::EvaluateScreen(LPCTSTR lpStrScreen, LPCTSTR lpStrSetName, LPCTSTR lpStrPeriods)
{
NativeDocument *screenDoc = NULL;
screenDoc = new NativeDocument;
calling the constructor causes a "Attempted to read write protected memory. ....memory corupt?..." error in the contstructor code.
I'm new to c++ coding as well as this interop stuff. Any ideas? Is there an issue instantiating native code from inside the /clr compiled c++? The code i'm using (EvaluateScreen) is lifted from another native DLL so the code in there should be good (i guess).
|
|
|
|
|
redivider wrote: Is there an issue instantiating native code from inside the /clr compiled c++
No. /clr compiler switch indicates that a mixed mode assembly has to be generated. It can work with both managed and unmanaged types.
Where is NativeDocument located? Is that in the DLL? Is your application multi-threaded?
Best wishes,
Navaneeth
|
|
|
|
|
Not multi-threaded.
NativeDocument is in another dll
C# dll -> /clr dll -> c++ dll (w/ NativeDocument class)
|
|
|
|
|
I couldn't reproduce this error. I have created a native DLL which has a sample NativeDocument class. Exported the functions and used this class from C++/CLI. Created a C# application and referred C++/CLI DLL there and everything worked as expected. If you can provide more information to reproduce, I will try.
Best wishes,
Navaneeth
|
|
|
|
|
im trying to use the tableLayoutPanel in my application but am stuck.
the panel seem to work on a grid system the is (y,x) and not (x,y).
i.e. on a (col, row) system and not a (row, col) system.
is there any way i can change this coordinate system?
please advise.
ikurtz.
|
|
|
|
|
Hi,
I m using Visual C++ .Net 2005.
Making a CLI based Windows Forms Applicaion.
But unable make object of Crystal Report .rpt class.
Is there any special header file i have to include for using Crystal Report, or can any one send me some sample code. That can be easier for me to understand.
Please Help.
Thanking you.
Kingshuk
modified on Wednesday, October 28, 2009 1:17 AM
|
|
|
|
|
Hi,
am new to VC++ and trying to display text on richtextbox and the width is irregular for each character.
Font setting used is as below
richtextbox1->Font = (gcnew System::Drawing::Font(L"Arial", 9.75F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,static_cast<System::Byte>(0)));
I want the text width to be uniform i.e to make it readable.
Thanks in advance
|
|
|
|
|
santoshkaif wrote: I want the text width to be uniform i.e to make it readable.
You should use Monospaced font[^]. Arial [^] is a sans-serif font. Try with Courier, Courier New or other monospaced font.
Nuri Ismail
|
|
|
|
|
Thanks!! Courier New worked for me.
|
|
|
|
|
I need to read in numbers until a new line. Once I hit the newline, it should leave the while loop. This isn't happening though with the code I wrote, any help would be appreciated!
...
while ( character != '\n' )
{
if( true( character, num ) )
{
execute code here
}
else
{
return -1;
}
cin >> chDigit;
}
...
|
|
|
|
|
What is "character"?
What is "num"?
What does this have to do with managed c++/cli?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
it's possible to some operation like:
IntPtr hdc = this->panel1->GetHdc();
Graphics ^newGraphics = Graphics::FromHdc(hdc);
newGraphics->DrawImageUnscaled(tmp,0,0);
this->panel1->ReleaseHdc(hdc);
in correct timing with vertical sync without going into directx?
if this is possible, can someone point me out a tutorial or example where i can learn this thing?
modified on Thursday, October 22, 2009 10:09 AM
|
|
|
|
|
Hi All
I am getting error when use command USE 12;(12 is database name)
Error is given below
Microsoft SQL-DMO (ODBC SQLState: 42000) Error: -2147221334
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near '12'.
Unknown error 0x800400AA
i am using code for use database is
<br />
<br />
Qry=spSQLServer->ExecuteWithResults((_bstr_t)"USE 12",(LONG)"IF EXISTS(SELECT * FROM sysdatabases WHERE name='12'".GetLength());<br />
|
|
|
|
|
I have the following native function call:
wchar_t* SXNative::ReturnString()
{
wchar_t retString[128];
wchar_t Test[] = L"This is a dummy";
wcscpy_s(retString, sizeof(Test) / sizeof(wchar_t), Test);
return retString;
}
The return value works fine from the native function.
In a C++/CLI wrapper class I have a managed type that marshalls the return type:
String^ ManagedWrapper::Managed_ReturnString()
{
wchar_t* test = nat_ptr->ReturnString();
return gcnew String(test);
}
The return type from the manaaged function returns garbage.
Any idea what is wrong with this?
Thanks in advance.
Jer 29:11
|
|
|
|
|
Al_S wrote: wchar_t* SXNative::ReturnString() {
wchar_t retString[128];
return retString;
}
IMO this isn't valid C or C++ code, it returns a pointer to a stack-based array, which is going to diappear in thin air as soon as the function returns. It may look like a good pointer on immediate inspection, but it will not work reliably.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? 59.24% waren verstandig genoeg om NEEN te stemmen; bye bye viaduct.
|
|
|
|
|
OK. It goes out of scope after it returns. How do I mend that?
Jer 29:11
modified on Tuesday, October 20, 2009 9:18 PM
|
|
|
|
|
by making sure it does not sit on the stack (the alternatives being static allocation and heap allocation).
In C, it would be a global array, or a malloc'ed buffer.
in C++ it could also be (a member of) an object, anything that gets gcnew'ed or is static.
And for anything dynamic, you would eventually have to deallocate it (e.g. call free on the thing that was malloc'ed).
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? 59.24% waren verstandig genoeg om NEEN te stemmen; bye bye viaduct.
|
|
|
|
|
Can you suggest something? I've struggled with mixed mode a bit
Jer 29:11
|
|
|
|
|
I don't know what it is you want to achieve. I guess this would be the simplest C++ code that should do it:
wchar_t* SXNative::ReturnString() {
return L"This is a dummy";
}
as now the string sits statically in memory.
If you need more C++ advice, better someone else kicks in. I answered the OP because it started as a P/Invoke issue, which it wasn't after all.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? 59.24% waren verstandig genoeg om NEEN te stemmen; bye bye viaduct.
|
|
|
|
|
Thanks. Not sure where the post was intended as P/Invoke. I was sure I was pursuing an interop question. What you posted is a portion of what I had initially. The native code worked as posted. It just goes out of scope when called my the managed function. As stated in the OP, I want to return a native string to a managed function that marshalls it to a System::String. Illustrated in the top of the thread
Jer 29:11
|
|
|
|
|
"Marshal" in the subject line got my attention...
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? 59.24% waren verstandig genoeg om NEEN te stemmen; bye bye viaduct.
|
|
|
|