Here is my .h file.
#pragma once
#include "pch.h"
#include "TCP_Page.g.h"
using namespace winrt;
using namespace std;
using namespace Windows::UI;
using namespace Windows::UI::Core;
using namespace Windows::UI::ViewManagement;
using namespace Windows::UI::Xaml;
using namespace Windows::UI::Xaml::Interop;
using namespace Windows::UI::Xaml::Controls;
using namespace Windows::UI::Xaml::Navigation;
using namespace Windows::UI::Xaml::Media::Animation;
using namespace Windows::Foundation;
using namespace Windows::Networking::Connectivity;
using namespace Windows::Storage::Streams;
enum class NotifyType
{
NoNotifyTypeMessage,
StatusMessage,
ErrorMessage
};
namespace winrt::GUI_Test::implementation
{
struct TCP_Page : TCP_PageT<TCP_Page>
{
TCP_Page();
void UpdateStatus(hstring strMessage, NotifyType type);
void NotifyUser(hstring strMessage, NotifyType type);
void NotifyUserFromAsyncThread(hstring strMessage, NotifyType type);
...
};
}
namespace winrt::GUI_Test::factory_implementation
{
struct TCP_Page : TCP_PageT<TCP_Page, implementation::TCP_Page>
{
};
}
Here is my IDL file.
namespace GUI_Test
{
[default_interface]
runtimeclass TCP_Page : Windows.UI.Xaml.Controls.Page
{
TCP_Page();
void UpdateStatus(String strMessage, NotifyType type);
void NotifyUser(String strMessage, NotifyType type);
void NotifyUserFromAsyncThread(String strMessage, NotifyType type);
}
}
Here is the error I get.
Error MIDL2011 [msg]unresolved type declaration [context]: GUI_Test.NotifyType [ Parameter 'type' of Procedure 'UpdateStatus'( RuntimeClass 'GUI_Test.TCP_Page' ) ]
I have never dealt with an IDL file before. Because NotifyType is an enum and is declared in the .h file, the IDL file can't resolve its type. I just don't know exactly what to do to solve the issue. Importing the .h file did not seem to fix it unless I put it on the wrong line which was the line before TCP_Page(). Since I made the enum a class, I figure that might be the problem. I suppose I could just add it to the IDL file, but then I will have 2 places that I need to maintain the code. Not a good solution.
This is probably easy to fix, I just have no clue on how to do it. Thanks.