Could not find the reference to GUID_DEVINTERFACE_NET class - c

I am using MS VS2008 to build my application. I need to use "GUID_DEVINTERFACE_NET " class to get the device interface list. But i could not find the reference to this class. I have even tried in MS VS2015 but could not the reference.
Below is the code snippet.
ULONG DeviceListLength = 0;
cr = CM_Get_Device_Interface_List_SizeW(&DeviceListLength,
(LPGUID)&GUID_DEVINTERFACE_NET,
NULL,
CM_GET_DEVICE_INTERFACE_LIST_PRESENT);

The Microsoft online documentation is not very detailed, but it does mention the header file Ndisguid.h. The filename might use a different case, but the Windows file system is not case-sensitive anyway:
#include <ndisguid.h>
references:
https://msdn.microsoft.com/en-us/library/windows/hardware/ff545922(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/hardware/ff538471(v=vs.85).aspx

Related

Auto-completion for mime-type entry

I'm looking for a way to have auto-completion on an Gtk.Entry for mime-type.
I'm sure there is a better way than declare
const string MIME_TYPES[] = { ... };
Maybe using an existing linux (gnome) library dealing with mime-types.
On Arch there is a package called "mime-types" providing the file /etc/mime.types lisintg something like 2000 types.
How can I use this file, is it a good solution or is it to specific to arch ?
thanks
string mime = File.new_for_uri(uri).query_info ("standard::content-type", 0, null).get_content_type ();

Missing MSDN documentation to develop xll add ins?

I spent quite a lot of time in looking for the full documentation of all the C API XLM Functions without success.
I found this page which illustrate a few of them:
http://msdn.microsoft.com/en-us/library/office/bb687910%28v=office.12%29.aspx
But for instance I wanted to understand and use xlfAddMenu, and I cannot find a page on MSDN that explain me.
Do you know if there is any documentation available? Apparently it is not so easy to get there.
There is no exhaustive official documentation for all C API XLM functions. However, as the documentation says following regarding C API XLM functions:
Many more functions are exposed by Excel via the C API that are useful
when you are developing XLLs. They correspond to the Excel worksheet
functions and functions and commands that are available from XLM macro
sheets."
Also, the EXAMPLE.[C,H] files which comme with the installation of the SDK use some of these functions and you can use it to learn how to use them. For instance, the xlfAddMenu is used in the xlAutoOpen callback function.
// In the following block of code, the Generic drop-down menu is created.
// Before creation, a check is made to determine if Generic already
// exists. If not, it is added. If the menu needs to be added, memory is
// allocated to hold the array of menu items. The g_rgMenu[] table is then
// transferred into the newly created array. The array is passed as an
// argument to xlfAddMenu to actually add the drop-down menu before the
// help menu. As a last step the memory allocated for the array is
// released.
//
// This block uses TempStr12() and TempNum12(). Both create a temporary
// XLOPER12. The XLOPER12 created by TempStr12() contains the string passed to
// it. The XLOPER12 created by TempNum12() contains the number passed to it.
// The Excel12f() function frees the allocated temporary memory. Both
// functions are part of the framework library.
Excel12f(xlfGetBar, &xTest, 3, TempInt12(10), TempStr12(L"Generic"), TempInt12(0));
if (xTest.xltype == xltypeErr)
{
hMenu = GlobalAlloc(GMEM_MOVEABLE,sizeof(XLOPER12) * g_rgMenuCols * g_rgMenuRows);
px = pxMenu = (LPXLOPER12) GlobalLock(hMenu);
for (i=0; i < g_rgMenuRows; i++)
{
for (j=0; j < g_rgMenuCols; j++)
{
px->xltype = xltypeStr;
px->val.str = TempStr12(g_rgMenu[i][j])->val.str;
px++;
}
}
xMenu.xltype = xltypeMulti;
xMenu.val.array.lparray = pxMenu;
xMenu.val.array.rows = g_rgMenuRows;
xMenu.val.array.columns = g_rgMenuCols;
Excel12f(xlfAddMenu,0,3,TempNum12(10),(LPXLOPER12)&xMenu,TempStr12(L"Help"));
GlobalUnlock(hMenu);
GlobalFree(hMenu);
}
According to me the best documentation (but not updated..) is the following book : Financial Applications using Excel Add-in Development in C / C++, 2nd Edition by Steve Dalton. You can find description of the xlfAddMenu function page 332. You can also find some useful information in the chm file of the Microsoft Excel XLL Software Development Kit, including codes examples (note I did not found the xlfAddMenu in it so I guess it is a depreciated function).

Composite C1 reference to Composite.dll not working at build time

I'm trying to implement a console library that reads data from Composite C1 (global datatype called RSS Feeds) and then, foreach RSS feed, the application must retrieve rss entries from the "link" attribute and insert all entries into a global datatype called "RSSItem".
Here is what i've done:
1. Open the website composite Solution
2. Create a new Console Library Project
3. Reference Composite.dll, Composite.generated.dll, ... into my new project
4. Implement the functionnality
Here is the problem:
At the design time, i have all reference working perfectly fine, I can write my code with intellisense. But when i want to launch the project (debug | release mode), the reference to composite is not working anymore ...
"Error 15 The type or namespace name 'Composite' could not be found (are you missing a using directive or an assembly reference?)"
When i do a refresh in the project browser, intelisense works again.
Thanks for your help.
Best regards,
Jonathan
PS: sorry for my english, not my native language
For info: here is a little bit of the code:
List<MCG.RSSItem> rssItemList = new List<MCG.RSSItem>();
for (int i = 0; i < 10; i++)
{
MCG.RSSItem rssItem = DataConnection.New<MCG.RSSItem>();
rssItem.Link = rss.Link;
rssItem.RSSFeed = rssFeed.Id;
rssItem.Summary = rss.Description;
rssItem.Title = rss.Title;
rssItem.PublicationStatus = "published";
rssItem.Id = Guid.NewGuid();
connection.Add<MCG.RSSItem>(rssItemList);
}
This problem was discussed here - http://compositec1.codeplex.com/discussions/357939
The problem was that Composite C1 from a std. Windows application is not supported.
Based on this problem the feature request was created - Refactor core parts of C1 to be used in "selfhost"

Reflection error when using F# sprintf "%A" on Windows Phone

I have a set of F# record types like this:
type Course =
{ Id : int
Title : string
Instructor : string
Duration : string
StartDate : string
IconUrl : string
Url : string
LectureSections : LectureSection list }
and LectureSection =
{ Title : string
Completed : bool
Lectures : Lecture list }
and Lecture =
{ Title : string
VideoUrl : string }
and at some point I call
sprintf "%A" course
where course is an instance of the Course record
On a regular .NET project this works fine, but on a Windows Phone 7.1 / Silverlight 4 F# project (I'm using Daniel Mohl's templates), I get this error:
Late bound operations cannot be performed on types or methods for which ContainsGenericParameters is true.
The problem seems to be the lists. Does anyone know of any way around this problem?
The templates should come with a custom built FSharp.Core.dll that disable features that are not available on Windows Phone. Are you sure you are compiling against this dll, and not the Windows PC one?
I had similar problems with Xbox360 and XNA. The F# team sent me a dll suitable for use for the Xbox360, along with some brief instructions on the settings used to build the dll.
Here is the propertygroup we've used to compile FSharp.Core:
<PropertyGroup Condition="'$(TargetFramework)'=='Xbox360\CompactFramework\3.7'">
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<XnaFrameworkVersion>v4.0</XnaFrameworkVersion>
<XnaPlatform>Xbox 360</XnaPlatform>
<XnaProfile>HiDef</XnaProfile>
<XnaCrossPlatformGroupID>a8d70e6b-9a75-4aec-80f8-62cf373f7368</XnaCrossPlatformGroupID>
<XnaOutputType>Game</XnaOutputType>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<DefineConstants>$(DefineConstants);FX_NO_ARRAY_LONG_LENGTH;FX_NO_DEBUG_PROXIES;FX_NO_EXIT;FX_FSLIB_IOBSERVABLE;FX_NO_WEB_CLIENT;FX_NO_WEB_REQUESTS;FX_NO_CHAR_PARSE;FX_NO_DEFAULT_DEPENDENCY_TYPE;FX_SIMPLE_SECURITY_PERMISSIONS;FX_NO_TRUNCATE;FX_NO_CULTURE_INFO_ARGS;FX_NO_REFLECTION_MODULE_HANDLES;FX_NO_OPERATION_CANCELLED;FX_NO_TO_LOWER_INVARIANT;FX_NO_EXIT_CONTEXT_FLAGS;FX_NO_BASED_ARRAYS;FX_NO_DOUBLE_BIT_CONVERTER;FX_NO_BINARY_SERIALIZATION;FX_NO_ASCII_ENCODING;FX_NO_DEFAULT_ENCODING;FX_NO_FILE_OPTIONS;FX_NO_NONBLOCK_IO;FX_NO_COMMAND_LINE_ARGS;FX_NO_ENVIRONMENT;FX_NO_PROCESS_START;FX_NO_APP_DOMAINS;FX_NO_PROCESS_DIAGNOSTICS;FX_FSLIB_STRUCTURAL_EQUALITY;FX_FSLIB_LAZY;FX_FSLIB_TUPLE;FX_NO_REFLECTION_EMIT</DefineConstants>
<Tailcalls>false</Tailcalls>
<!-- It would be better to use MSBuild resolution here, but the TargetFrameworkIdentifier etc. aren't set up quite correctly as yet -->
<OtherFlags>$(OtherFlags) --simpleresolution -r:"C:\Program Files\Microsoft XNA\XNA Game Studio\v4.0\References\Xbox360\mscorlib.dll"</OtherFlags>
</PropertyGroup>
and the new .targets we use:
<Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\Microsoft.Xna.GameStudio.targets" Condition="'$(TargetFramework)'=='Xbox360\CompactFramework\3.7'"/>
The dll they sent me was working fine, and I never had to use these instructions, but they might be useful to someone who wants to build an FSharp.Core.dll for a new platform. Note in particular the DefineConstants part.

Octave select a file?

Does Octave have a good way to let the user select an input file? I've seen code like this for Matlab, but doesn't work in Octave.
A gui based method would be preferred, but some sort of command-line choice would work also. It would be great if there were some way to do this that would work in both Matlab and Octave.
I found this for Matlab but it does not work in Octave, even when you install Octave Forge Java package for the listdlg function. In Octave, dir() gives you:
647x1 struct array containing the fields:
name
date
bytes
isdir
datenum
statinfo
but I don't know how to convert this to an array of strings listdlg expects.
You have already the Octave Forge java package installed, so you can create instances of any java class and call any java method.
For example to create a JFileChooser and call the JFileChooser.showOpenDialog(Component parent) method:
frame = javaObject("javax.swing.JFrame");
frame.setBounds(0,0,100,100);
frame.setVisible(true);
fc = javaObject ("javax.swing.JFileChooser")
returnVal = fc.showOpenDialog(frame);
file = fc.getSelectedFile();
file.getName()
Btw. I had some troubles installing the package.
Here is a fix for Ubuntu. that worked also for my Debian Testing.
EDIT
#NoBugs In reply to your comment:
If you need to use listdlg you can do the following:
d = dir;
str = {d.name};
[sel,ok] = listdlg('PromptString','Select a file:',...
'SelectionMode','single',...
'ListString',str);
if ok == 1
disp(str{sel(1)});
end
This should be compatible with matlab, by I cannot test it right now.
If you want to select multiple files use this:
d = dir;
str = {d.name};
[sel,ok] = listdlg('PromptString','Select a file:',...
'SelectionMode','multiple',...
'ListString',str);
if ok == 1
imax = length(sel);
for i=1:1:imax
disp(str{sel(i)});
end
end
I never came across an open-file-dialog in octave.
If you are looking for a gui based method maybe guioctave can help you. I never used it, because it appears only be available for windows machines.
A possible solution would be to write a little script in octave, that would allow the user to parse through the directories and select a file like that.
Thought I'd provide an updated answer to this old question, since it is appearing in the 'related questions' field for other questions.
Octave provides the uigetdir and uigetfile functions, which do what you expect.

Resources