|
How can i change the system date style formate through code.
I have a project when it starts it compare the current date withe the condition date is the date formate is wrong it give error plz help me out.
|
|
|
|
|
Don't cross post, it's considered rude
|
|
|
|
|
I post the same question at C# and C++ community, because may be C++ developer answer my question.
I maximum i post question at C# post.
What make you rude plz explan
|
|
|
|
|
If you double post, you may get the same answer in two or more locations by different people. So, you are hogging these people time and effort from other posters who want their question answered also. You are the rude person!
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Hey i'm new to visual C++ and i'm using windows forms but that forum doesn't seem to get answered.
I'm wondering how to call a method from a class in the form1.h?
so for example:
form1.h
private: System::Void testToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e)
//Not sure how to call the test method
{
Class test
void test()
{
//Code here
}
|
|
|
|
|
newkid wrote: that forum doesn't seem to get answered
Sure people answer in that forum. You have to give them time.
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
Hello,
I have the following problem.
I have a Data Grid View with several columns and rows.
Now, in all lines of a global row, in which all values above the line should be counted together.
The combined count and draw the line is not my problem, the whole line is properly displayed.
BUT, if the user on the column name clicks to the column to sort, the total line of sorts, ie it is no longer at the bottom.
White someone such as I realize an overall line?
Thank you for the effort.
(This text was translated by Google )
|
|
|
|
|
First, I mainly program in C#, not C++. I hate to have to ask for help with such an elementary question, but I can't find a solution to my problem.
I have a simple "hello world" program, which is a CLR console app. Nothing special there. When I run it through Visual Studio, it works just fine. But when I build it, I have no .exe file in my Release or Debug folders. I have these files instead (by the way, I had to re-install my VS a week ago, so it's basically right out of the box as far as any configuration):
app.res
AssemblyInfo.obj
BuildLog.htm
HelloWorld2.exe.intermediate.manifest
HelloWorld2.obj
HelloWorld2.pch
mt.dep
stdafx.obj
vc80.idb
vc80.pdb
If it would be helpful I can also paste a copy of the BuildLog.
Thank-you in advance for any help.
BW
|
|
|
|
|
Hopefully you found it by now. If not, keep looking in the folders it's there, really it is.
led mike
|
|
|
|
|
Unfortunately it's really not in there. I even thought it might be hidden for some reason, and so made sure hidden files were being shown in explorer...that list from above is what was showing when I went to the folders and did 'dir' on the command line.
|
|
|
|
|
In the project settings->Linker/General/Output File...what's there?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
$(OutDir)\$(ProjectName).exe
|
|
|
|
|
Ok, then
"$(OutDir)" is project settings->Configuration properties/General/Output Directory
That should give you all the pathname info
It wouldn't run in the debugger if it wasn't built to an EXE...
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
first, thank you very much for your time...
that is shown as "$(SolutionDir)$(ConfigurationName)"
So if my solution is HelloWorld, and that's the directory, I'm building for Debug...
shouldn't it be in /HelloWorld/Debug/ ?
I don't disagree it wouldn't run without having an .exe ....this is just maddening
BW
|
|
|
|
|
Ok, here's what I did...
I set the directory manually to C:\
and it's there!!!
Do you have any idea why it didn't work before?
BW
|
|
|
|
|
figured it out...changed it to ProjectDir and there it is
I hadn't noticed the Debug folder before in my solution directory though...I also had done some release builds, with the same result and also no Release folder in my solution directory....so not sure what's going on there, but it's working now
Thanks bunches and bunches Mark...as trivial as it seems, I appreciate it.
|
|
|
|
|
bwilhite wrote: I hadn't noticed the Debug folder before in my solution directory though
Ok, I have to say it. "I told you so"
led mike
|
|
|
|
|
Well, coming from C# world...I expected it one place, and evidently my brain decided to see it only if it was in that one place. Thanks again.
|
|
|
|
|
I have comodo firewall and defense installed on my machine, and if I put the level up high enough, then it tells me that HelloWorld.exe is being executed when I run through the debugger, but after that it's not there...I don't know if that provides a clue or not...here's the build log:
Command Lines
Creating temporary file "c:\Documents and Settings\Brandon Wilhite\Desktop\Auxiliary Projects\WindowsServiceProofOfConcept\HelloWorld2\Debug\RSP00000138963340.rsp" with contents
[
/Od /D "WIN32" /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /FD /EHa /MDd /Yu"stdafx.h" /Fp"Debug\HelloWorld2.pch" /Fo"Debug\\" /Fd"Debug\vc80.pdb" /W3 /c /Zi /clr /TP /FU "c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll" /FU "c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.dll" /FU "c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.XML.dll"
".\HelloWorld2.cpp"
".\AssemblyInfo.cpp"
]
Creating command line "cl.exe @"c:\Documents and Settings\Brandon Wilhite\Desktop\Auxiliary Projects\WindowsServiceProofOfConcept\HelloWorld2\Debug\RSP00000138963340.rsp" /nologo /errorReport:prompt"
Creating temporary file "c:\Documents and Settings\Brandon Wilhite\Desktop\Auxiliary Projects\WindowsServiceProofOfConcept\HelloWorld2\Debug\RSP00000238963340.rsp" with contents
[
/Od /D "WIN32" /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /FD /EHa /MDd /Yc"stdafx.h" /Fp"Debug\HelloWorld2.pch" /Fo"Debug\\" /Fd"Debug\vc80.pdb" /W3 /c /Zi /clr /TP /FU "c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll" /FU "c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.dll" /FU "c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.XML.dll"
".\stdafx.cpp"
]
Creating command line "cl.exe @"c:\Documents and Settings\Brandon Wilhite\Desktop\Auxiliary Projects\WindowsServiceProofOfConcept\HelloWorld2\Debug\RSP00000238963340.rsp" /nologo /errorReport:prompt"
Creating command line "rc.exe /d "_UNICODE" /d "UNICODE" /fo"Debug/app.res" ".\app.rc""
Creating temporary file "c:\Documents and Settings\Brandon Wilhite\Desktop\Auxiliary Projects\WindowsServiceProofOfConcept\HelloWorld2\Debug\RSP00000538963340.rsp" with contents
[
/OUT:"C:\Documents and Settings\Brandon Wilhite\Desktop\Auxiliary Projects\WindowsServiceProofOfConcept\Debug\HelloWorld2.exe" /INCREMENTAL /MANIFEST /MANIFESTFILE:"Debug\HelloWorld2.exe.intermediate.manifest" /DEBUG /ASSEMBLYDEBUG /PDB:"c:\Documents and Settings\Brandon Wilhite\Desktop\Auxiliary Projects\WindowsServiceProofOfConcept\debug\HelloWorld2.pdb" /MACHINE:X86 /FIXED:No ".\Debug\AssemblyInfo.obj"
".\Debug\HelloWorld2.obj"
".\Debug\stdafx.obj"
".\Debug\app.res"
]
Creating command line "link.exe @"c:\Documents and Settings\Brandon Wilhite\Desktop\Auxiliary Projects\WindowsServiceProofOfConcept\HelloWorld2\Debug\RSP00000538963340.rsp" /NOLOGO /ERRORREPORT:PROMPT"
Creating temporary file "c:\Documents and Settings\Brandon Wilhite\Desktop\Auxiliary Projects\WindowsServiceProofOfConcept\HelloWorld2\Debug\RSP00000638963340.rsp" with contents
[
/outputresource:"..\debug\HelloWorld2.exe;#1" /manifest
".\Debug\HelloWorld2.exe.intermediate.manifest"
]
Creating command line "mt.exe @"c:\Documents and Settings\Brandon Wilhite\Desktop\Auxiliary Projects\WindowsServiceProofOfConcept\HelloWorld2\Debug\RSP00000638963340.rsp" /nologo"
Creating temporary file "c:\Documents and Settings\Brandon Wilhite\Desktop\Auxiliary Projects\WindowsServiceProofOfConcept\HelloWorld2\Debug\BAT00000738963340.bat" with contents
[
@echo Manifest resource last updated at %TIME% on %DATE% > ".\Debug\mt.dep"
]
Creating command line """c:\Documents and Settings\Brandon Wilhite\Desktop\Auxiliary Projects\WindowsServiceProofOfConcept\HelloWorld2\Debug\BAT00000738963340.bat"""
Output Window
Compiling...
stdafx.cpp
Compiling...
HelloWorld2.cpp
AssemblyInfo.cpp
Generating Code...
Compiling resources...
Linking...
Embedding manifest...
|
|
|
|
|
Hi,
I'm trying to marshal a struct in unmanaged memory but it doesn't work.
I have my Windows Service that is filling up the struct's fields and then calls the API DeviceIoControl passing as argument an IntPtr.
When I debug my driver (kernel mode) I'm not able to see the real values of the fields but only random data. Someone can tell me what's wrong?
This is my code:
<br />
[DllImport("kernel32.dll", SetLastError = true)]<br />
extern bool DeviceIoControl(IntPtr hDevice, int dwIoControlCode, IntPtr lpInBuffer, int nInBufferSize, IntPtr lpOutBuffer, int nOutBufferSize, int %lpBytesReturned, IntPtr lpOverlapped);<br />
<br />
[StructLayout(LayoutKind::Sequential)]<br />
public ref struct OPEN_FILE_INFORMATION<br />
{<br />
UInt64 FileSize;<br />
bool ReadOnly;<br />
UInt16 FileNameLength;<br />
[MarshalAs(UnmanagedType::ByValArray, SizeConst=1)]<br />
String ^FileName;<br />
};<br />
<br />
public: void Mount(void)<br />
{<br />
<br />
...........<br />
<br />
OPEN_FILE_INFORMATION ^OpenFileInformation = gcnew OPEN_FILE_INFORMATION();<br />
<br />
String ^ImagePath = this->AppPath + "\\VirtualDisk.disk";<br />
int structSize = Marshal::SizeOf(OPEN_FILE_INFORMATION::typeid);<br />
int totalStructSize = structSize + ImagePath->Length;<br />
<br />
OpenFileInformation->FileSize = 8388608;
OpenFileInformation->ReadOnly = false;<br />
OpenFileInformation->FileNameLength = ImagePath->Length;<br />
OpenFileInformation->FileName = ImagePath;<br />
<br />
IntPtr ofiPtr = Marshal::AllocHGlobal(totalStructSize);<br />
Marshal::StructureToPtr(OpenFileInformation, ofiPtr, true);<br />
<br />
cli::array<unsigned char, 1> ^tokens = Text::Encoding::Unicode->GetBytes(ImagePath);<br />
<br />
int offset = 11;<br />
<br />
for each (unsigned char c in tokens)<br />
{<br />
Marshal::WriteByte(ofiPtr, offset, c);<br />
offset++;<br />
}<br />
<br />
if (!DeviceIoControl(Device, IOCTL_FILE_DISK_OPEN_FILE, ofiPtr, totalStructSize - 1, IntPtr::Zero, 0, BytesReturned, IntPtr::Zero))<br />
{<br />
DefineDosDevice(DDD_REMOVE_DEFINITION, DriveLetter + ":", nullptr);<br />
}<br />
<br />
Marshal::FreeHGlobal(ofiPtr);<br />
}<br />
Thanks in advance.
Sorry for my poor english.
|
|
|
|
|
Is there some reason your not calling DeviceIOControl using native code?
led mike
|
|
|
|
|
Because my service is written using dotnet.. I need to mount a virtual disk via DeviceIoControl from my service, so I think I'm forced to use managed code. Do you think I can use native code from my managed service? How?
|
|
|
|
|
Member 4124873 wrote: Do you think I can use native code from my managed service?
No I don't think you can, I know you can.
Member 4124873 wrote: How?
Ok, this is like deja vu all over again. People tend to get real upset when I tell them this but here goes.
Software developers really really should understand the technology they intend to use in a product PRIOR to developing the product. In this particular case one piece of the technologies you are attempting to use is both managed and unmanaged memory and/or code. IMHO you do not understand this technology well enough to be doing anything with it beyond studying and research for the purpose of learning about it.
There are many resources available in this regard. One is a set of articles here on CodeProject that introduce C++/CLI programming to beginners.
led mike
|
|
|
|
|
I had a problem marshaling a C struct. Part of my solution involved Custom Marshalling (ICustomMarshaler). Since I cannot write an article or a book chapter here, you need to follow led mike's advice. However, I can suggest a book that can help you out:
Expert C++/CLI: .NET for Visual C++ Programmers, Marcus Heege
Apress, ISBN: 978-1-59059-756-9 (Print) 978-1-4302-0357-5 (Online)
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Thank you led mike and George!
|
|
|
|